一、series

  1. import pandas as pd
  2. import string
  3.  
  4. #创建Series的两种方式
  5. #方式一
  6. t = pd.Series([1,2,3,4,43],index=list('asdfg'))
  7. print(t)
  8. #方式二
  9. temp_dict = {'name':'xiaohong','age':30,'tel':10086}
  10. t2 = pd.Series(temp_dict)
  11. print(t2)
  12. #字典推导式
  13. a = {string.ascii_uppercase[i]:i for i in range(10)}
  14. print(a)
  15. print(pd.Series(a))
  16. print(pd.Series(a,index=list(string.ascii_uppercase[5:15]))) 

二、read_file

  1. import pandas as pd
  2. from pymongo import MongoClient
  3.  
  4. #pandas读取csv文件
  5. # df = pd.read_csv('dogNames2.csv')
  6. # print(df)
  7.  
  8. client = MongoClient()
  9. collection = client['meipai']['meipai_video']
  10. data = collection.find()
  11. data_list = []
  12. for i in data:
  13. temp = {}
  14. temp['cut_url'] = i['cut_url']
  15. temp['create_time'] = i['create_time']
  16. temp['title'] = i['title']
  17. temp['video_url'] = i['video_url']
  18. data_list.append(temp)
  19.  
  20. # print(data)
  21. # t1 = data[0]
  22. # t1 = pd.Series(t1)
  23. # print(t1)
  24.  
  25. df = pd.DataFrame(data_list)
  26. print(df.info())
  27. print(df.describe())
  28. # print(df.head())
  29. # print('*'*100)
  30. # print(df.tail())

 三、dataframe

  示例一

  1. import pandas as pd
  2.  
  3. temp_dict = {'name':['xiaohong','xiaozhang'],'age':[30,23],'tel':[10086,10010]}
  4. t1 = pd.DataFrame(temp_dict)
  5. print(t1)
  6.  
  7. temp_dict1 = [{'name':'xiaohong','age':23,'tel':10086},{'name':'xiaogang','age':12},{'name':'xiaozhang','tel':10010}]
  8. t2 = pd.DataFrame(temp_dict1)
  9. print(t2)

   示例二

  1. import pandas as pd
  2.  
  3. #pandas读取csv文件
  4. df = pd.read_csv('dogNames2.csv')
  5. # print(df.head())
  6. # print(df.info())
  7.  
  8. #DataFrame中排序的方法
  9. df = df.sort_values(by='Count_AnimalName',ascending=False)
  10. # print(df.head())
  11.  
  12. #pandas取行和列的注意事项
  13. # - 方括号写数组,表示取行,对行进行操作
  14. # - 写字符串,表示取列索引,对列进行操作
  15. print(df[:20])
  16. print(df[:20]['Row_Labels'])
  17. print(type(df['Row_Labels']))
  18.  
  19. #bool索引
  20. print(df[(df['Row_Labels'].str.len()>4)&(df['Count_AnimalName']>800)])

 四、电影数据案例

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3.  
  4. file_path = './IMDB-Movie-data.csv'
  5. df = pd.read_csv(file_path)
  6. # print(df.head(1))
  7. # print(df.info())
  8.  
  9. # rating,runtime分布情况
  10. # 选择图形:直方图
  11. # 准备数据
  12. runtime_data = df['Runtime (Minutes)'].values
  13. max_runtime = runtime_data.max()
  14. min_runtime = runtime_data.min()
  15.  
  16. #计算组距
  17. num_bin = (max_runtime-min_runtime)//5
  18.  
  19. #设置图行大小
  20. plt.figure(figsize=(13,6),dpi=80)
  21. #画直方图
  22. plt.hist(runtime_data,num_bin)
  23.  
  24. plt.xticks(range(min_runtime,max_runtime+5,5))
  25.  
  26. #显示
  27. plt.show()

电影案例二

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3. from functools import reduce
  4.  
  5. file_path = './IMDB-Movie-data.csv'
  6. df = pd.read_csv(file_path)
  7. # print(df.head(1))
  8. # print(df.info())
  9.  
  10. # rating,runtime分布情况
  11. # 选择图形:直方图
  12. # 准备数据
  13. # runtime_data = df['Runtime (Minutes)'].values
  14. rate_data = df['Rating'].values
  15. max_rate = rate_data.max()
  16. min_rate = rate_data.min()
  17.  
  18. #设置不等宽组距,hist方法中取到的会是一个左闭右开的区间[1,9,3.5)
  19. num_bin_list = [1.9,3.5]
  20. i = 3.5
  21. while i<=max_rate:
  22. i += 0.5
  23. num_bin_list.append(i)
  24. print(num_bin_list)
  25.  
  26. #设置图形大小
  27. plt.figure(figsize=(13,6),dpi=80)
  28. #画直方图
  29. plt.hist(rate_data,num_bin_list)
  30.  
  31. #xticks让之前的组距能够对上
  32. plt.xticks(num_bin_list)
  33.  
  34. #显示
  35. plt.show()

  

  1. [1.9, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5]

 五。常用统计方法

  1. import numpy
  2. import pandas as pd
  3. df = pd.read_csv('IMDB-Movie-Data.csv')
  4. print(df.info())
  5. print(df.describe())
  6. #获取评分的均分
  7. rate_mean = df.Rating.mean()
  8. print(rate_mean)
  9. #获取导演的人数
  10. print(df.Director.value_counts().count())
  11. print(len(set(df.Director.tolist())))
  12. print(len(df.Director.unique()))
  13. #获取演员的人数
  14. temp_actors_list = df.Actors.str.split(',').tolist()
  15. actors_list = [i for j in temp_actors_list for i in j]
  16. # numpy.array(temp_actors_list).flatten()
  17. actors_num = len(set(actors_list))
  18. print(actors_num)
  19. <class 'pandas.core.frame.DataFrame'>
  20. RangeIndex: 1000 entries, 0 to 999
  21. Data columns (total 12 columns):
  22. Rank 1000 non-null int64
  23. Title 1000 non-null object
  24. Genre 1000 non-null object
  25. Description 1000 non-null object
  26. Director 1000 non-null object
  27. Actors 1000 non-null object
  28. Year 1000 non-null int64
  29. Runtime (Minutes) 1000 non-null int64
  30. Rating 1000 non-null float64
  31. Votes 1000 non-null int64
  32. Revenue (Millions) 872 non-null float64
  33. Metascore 936 non-null float64
  34. dtypes: float64(3), int64(4), object(5)
  35. memory usage: 93.8+ KB
  36. None
  37. Rank Year ... Revenue (Millions) Metascore
  38. count 1000.000000 1000.000000 ... 872.000000 936.000000
  39. mean 500.500000 2012.783000 ... 82.956376 58.985043
  40. std 288.819436 3.205962 ... 103.253540 17.194757
  41. min 1.000000 2006.000000 ... 0.000000 11.000000
  42. 25% 250.750000 2010.000000 ... 13.270000 47.000000
  43. 50% 500.500000 2014.000000 ... 47.985000 59.500000
  44. 75% 750.250000 2016.000000 ... 113.715000 72.000000
  45. max 1000.000000 2016.000000 ... 936.630000 100.000000
  46. [8 rows x 7 columns]

 六、统计分类情况

  1. # -*- coding: utf-8 -*-
  2.  
  3. """
  4. @Datetime: 2018/11/19
  5. @Author: Zhang Yafei
  6. """
  7. """
  8. 对于这一组电影数据,如果我们希望统计电影分类(genre)的情况,应该如何处理数据?
  9. 思路:重新构造一个全为0的数组,列名为分类,如果某一条数据中分类出现过,就让0变为1
  10. """
  11. import numpy as np
  12. import pandas as pd
  13. from matplotlib import pyplot as plt
  14. from matplotlib import font_manager
  15.  
  16. #中文字体
  17. my_font = font_manager.FontProperties(family='SimHei')
  18. #显示完整的列
  19. pd.set_option('display.max_columns', None)
  20.  
  21. df = pd.read_csv('IMDB-Movie-Data.csv')
  22. #统计分类列表
  23. temp_list = df.Genre.str.split(',').tolist()
  24. genre_list = list(set([i for j in temp_list for i in j]))
  25.  
  26. #构造全为0的数组
  27. zero_df = pd.DataFrame(np.zeros((df.shape[0],len(genre_list))),columns=genre_list)
  28. # print(zero_df)
  29. #给每个电影出现分类的位置赋值1
  30. for i in range(df.shape[0]):
  31. zero_df.loc[i,temp_list[i]] = 1
  32.  
  33. # print(zero_df.head(1))
  34. genre_count = zero_df.sum(axis=0)
  35. print(genre_count)
  36.  
  37. #排序
  38. genre_count = genre_count.sort_values()
  39. _x = genre_count.index
  40. _y = genre_count.values
  41. #画图
  42. plt.figure(figsize=(15,6),dpi=80)
  43. plt.bar(range(len(_x)),_y,width=0.4,color="orange")
  44. plt.xticks(range(len(_x)),_x)
  45. plt.title('电影分类统计图',fontproperties=my_font)
  46. plt.show()

  

 七、数据分组与聚合

  1. # -*- coding: utf-8 -*-
  2.  
  3. """
  4. @Datetime: 2018/11/19
  5. @Author: Zhang Yafei
  6. """
  7. """
  8. 现在我们有一组关于全球星巴克店铺的统计数据,如果我想知道美国的星巴克数量和中国的哪个多,或者我想知道中国每个省份星巴克的数量的情况,那么应该怎么办?
  9. 思路:遍历一遍,每次加1 ???
  10. """
  11. import pandas as pd
  12.  
  13. pd.set_option('display.max_columns', None)
  14.  
  15. df = pd.read_csv('starbucks_store_worldwide.csv')
  16. # print(df.head(1))
  17. # print(df.info())
  18. grouped = df.groupby(by='Country')
  19. # print(grouped)
  20.  
  21. # DataFrameGroupBy
  22. # 可以进行遍历
  23. # for i,j in grouped:
  24. # print(i)
  25. # print('-'*100)
  26. # print(j)
  27. # print('*'*100)
  28. country_count = grouped['Brand'].count()
  29. # print(country_count['US'])
  30. # print(country_count['CN'])
  31.  
  32. #统计中国每个省份店铺的数量
  33. china_data = df[df.Country == 'CN']
  34. china_grouped = china_data.groupby(by='State/Province').count()['Brand']
  35. # print(china_grouped)
  36. #数据按照多个条件进行分组
  37. brand_grouped = df['Brand'].groupby(by=[df['Country'],df['State/Province']]).count()
  38. # print(brand_grouped)
  39. # print(type(brand_grouped))
  40. #数据按照多个条件进行分组,返回dataframe
  41. brand_grouped1 = df[['Brand']].groupby(by=[df['Country'],df['State/Province']]).count()
  42. brand_grouped2 = df.groupby(by=[df['Country'],df['State/Province']])[['Brand']].count()
  43. brand_grouped3 = df.groupby(by=[df['Country'],df['State/Province']]).count()[['Brand']]
  44. # print(brand_grouped1)
  45. # print(brand_grouped2)
  46. # print(brand_grouped3)
  47. #索引的方法和属性
  48. print(brand_grouped1)
  49. print(brand_grouped1.index)

 八、分组聚合

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3.  
  4. pd.set_option('display.max_columns', None)
  5.  
  6. df = pd.read_csv('starbucks_store_worldwide.csv')
  7.  
  8. df = df.groupby(by='Country').count()['Brand'].sort_values(ascending=False)[:10]
  9.  
  10. _x = df.index
  11. _y = df.values
  12.  
  13. #画图
  14. plt.figure(figsize=(13,6),dpi=80)
  15.  
  16. plt.bar(_x,_y)
  17.  
  18. plt.show()

 

分组聚合二

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3. from matplotlib import font_manager
  4.  
  5. my_font = font_manager.FontProperties(family='SimHei')
  6.  
  7. pd.set_option('display.max_columns', None)
  8.  
  9. df = pd.read_csv('starbucks_store_worldwide.csv')
  10. df = df[df['Country']=='CN']
  11. print(df.head(1))
  12.  
  13. df = df.groupby(by='City').count()['Brand'].sort_values(ascending=False)[:25]
  14.  
  15. _x = df.index
  16. _y = df.values
  17.  
  18. #画图
  19. plt.figure(figsize=(13,6),dpi=80)
  20.  
  21. # plt.bar(_x,_y,width=0.3,color='orange')
  22. plt.barh(_x,_y,height=0.3,color='orange')
  23.  
  24. # plt.xticks(_x,fontproperties=my_font)
  25. plt.yticks(_x,fontproperties=my_font)
  26.  
  27. plt.show()

  

九、book_data

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3.  
  4. pd.set_option('display.max_columns', None)
  5.  
  6. df = pd.read_csv('books.csv')
  7. # print(df.info())
  8. data = df[pd.notnull(df['original_publication_year'])]
  9. grouped = data.groupby(by='original_publication_year').count()['title']
  10. # print(grouped)
  11.  
  12. grouped1 = data.average_rating.groupby(by=data['original_publication_year']).mean()
  13. # print(grouped1)
  14.  
  15. _x = grouped1.index
  16. _y = grouped1.values
  17.  
  18. plt.figure(figsize=(15,6),dpi=80)
  19. plt.plot(range(len(_x)),_y)
  20. plt.xticks(range(len(_x))[::10],_x[::10].astype(int),rotation=45)
  21. plt.show()

  

十、911data

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3. import numpy as np
  4.  
  5. pd.set_option('display.max_columns',None)
  6.  
  7. df = pd.read_csv('911.csv')
  8. # print(df.head(1))
  9. # print(df.info())
  10.  
  11. #获取分类
  12. temp_list = df.title.str.split(':').tolist()
  13. cate_list = list(set([i[0] for i in temp_list]))
  14. # print(cate_list)
  15.  
  16. #构造全为0的数组
  17. zeros_df = pd.DataFrame(np.zeros((df.shape[0],len(cate_list))),columns=cate_list)
  18.  
  19. #赋值
  20. for cate in cate_list:
  21. zeros_df[cate][df.title.str.contains(cate)] = 1
  22. print(zeros_df)
  23.  
  24. sum_ret = zeros_df.sum(axis=0)
  25. print(sum_ret)  

示例二

  1. import pandas as pd
  2. from matplotlib import pyplot as plt
  3. import numpy as np
  4.  
  5. pd.set_option('display.max_columns',None)
  6.  
  7. df = pd.read_csv('911.csv')
  8. # print(df.head(1))
  9. # print(df.info())
  10.  
  11. #获取分类
  12. temp_list = df.title.str.split(':').tolist()
  13. cate_list = [i[0] for i in temp_list]
  14.  
  15. df['cate'] = pd.DataFrame(np.array(cate_list).reshape(df.shape[0],1))
  16. print(df.groupby(by='cate').count()['title']) 

十一、时间序列

实例一

  1. # -*- coding: utf-8 -*-
  2.  
  3. """
  4. @Datetime: 2018/11/19
  5. @Author: Zhang Yafei
  6. """
  7. """
  8. 统计出911数据中不同月份电话次数的变化情况
  9. """
  10. import pandas as pd
  11. from matplotlib import pyplot as plt
  12. import numpy as np
  13.  
  14. pd.set_option('display.max_columns',None)
  15.  
  16. df = pd.read_csv('911.csv')
  17. df.drop_duplicates()
  18. df.timeStamp = pd.to_datetime(df.timeStamp) #时间字符串转时间格式
  19.  
  20. df.set_index('timeStamp',inplace=True) #设置时间格式为索引
  21. # print(df.head())
  22.  
  23. #统计出911数据中不同月份电话次数
  24. count_by_month = df.resample('M').count()['title']
  25. print(count_by_month)
  26.  
  27. #画图
  28. _x = count_by_month.index
  29. _y = count_by_month.values
  30.  
  31. plt.figure(figsize=(15,8),dpi=80)
  32.  
  33. plt.plot(range(len(_x)),_y)
  34.  
  35. plt.xticks(range(len(_x)),_x.strftime('%Y-%m-%d'),rotation=45)
  36.  
  37. plt.show()

  

实例二

  1. # -*- coding: utf-8 -*-
  2.  
  3. """
  4. @Datetime: 2018/11/19
  5. @Author: Zhang Yafei
  6. """
  7. """
  8. 统计出911数据中不同月份不同类型的电话的次数的变化情况
  9. """
  10. import pandas as pd
  11. from matplotlib import pyplot as plt
  12. import numpy as np
  13.  
  14. pd.set_option('display.max_columns',None)
  15.  
  16. df = pd.read_csv('911.csv')
  17. #把时间字符串转化为时间类型设置为索引
  18. df.timeStamp = pd.to_datetime(df.timeStamp)
  19.  
  20. #添加列,表示分类
  21. temp_list = df.title.str.split(':').tolist()
  22. cate_list = [i[0] for i in temp_list]
  23. df['cate'] = pd.DataFrame(np.array(cate_list).reshape(df.shape[0],1))
  24.  
  25. df.set_index('timeStamp',inplace=True)
  26.  
  27. plt.figure(figsize=(15, 8), dpi=80)
  28.  
  29. #分组
  30. for group_name,group_data in df.groupby(by='cate'):
  31. #对不同的分类都进行绘图
  32. count_by_month = group_data.resample('M').count()['title']
  33. # 画图
  34. _x = count_by_month.index
  35. _y = count_by_month.values
  36. plt.plot(range(len(_x)),_y,label=group_name)
  37.  
  38. plt.xticks(range(len(_x)), _x.strftime('%Y-%m-%d'), rotation=45)
  39.  
  40. plt.legend(loc='best')
  41. plt.show()

  

实例三:pm2.5

  1. # -*- coding: utf-8 -*-
  2.  
  3. """
  4. @Datetime: 2018/11/19
  5. @Author: Zhang Yafei
  6. """
  7. """
  8. 绘制美国和中国PM2.5随时间的变化情况
  9. """
  10. import pandas as pd
  11. from matplotlib import pyplot as plt
  12.  
  13. pd.set_option('display.max_columns',None)
  14.  
  15. df = pd.read_csv('PM2.5/BeijingPM20100101_20151231.csv')
  16. # print(df.head())
  17.  
  18. #把分开的时间字符串通过periodIndex的方法转化为pandas的时间类型
  19. period = pd.PeriodIndex(year=df.year,month=df.month,day=df.day,hour=df.hour,freq='H')
  20. df['datetime'] = period
  21. print(df.head(10))
  22.  
  23. #把datetime设置为索引
  24. df.set_index('datetime',inplace=True)
  25.  
  26. #进行降采样
  27. df = df.resample('7D').mean()
  28.  
  29. #处理缺失值,删除缺失数据
  30. # data = df['PM_US Post'].dropna()
  31. # china_data = df['PM_Nongzhanguan'].dropna()
  32. data = df['PM_US Post']
  33. china_data = df['PM_Nongzhanguan']
  34.  
  35. #画图
  36. _x = data.index
  37. _y = data.values
  38.  
  39. _x_china = china_data.index
  40. _y_china = china_data.values
  41.  
  42. plt.figure(figsize=(13,8),dpi=80)
  43.  
  44. plt.plot(range(len(_x)),_y,label='US_POST',alpha=0.7)
  45. plt.plot(range(len(_x_china)),_y_china,label='CN_POST',alpha=0.7)
  46.  
  47. plt.xticks(range(0,len(_x_china),10),list(_x_china.strftime('%Y%m%d'))[::10],rotation=45)
  48.  
  49. plt.show()

  

Pandas系列(十四)- 实战案例的更多相关文章

  1. struts2官方 中文教程 系列十四:主题Theme

    介绍 当您使用一个Struts 2标签时,例如 <s:select ..../>  在您的web页面中,Struts 2框架会生成HTML,它会显示外观并控制select控件的布局.样式和 ...

  2. MP实战系列(十四)之分页使用

    MyBatis Plus的分页,有插件式的,也有其自带了,插件需要配置,说麻烦也不是特别麻烦,不过觉得现有的MyBatis Plus足以解决,就懒得配置插件了. MyBatis Plus的资料不算是太 ...

  3. 闯祸了,生成环境执行了DDL操作《死磕MySQL系列 十四》

    由于业务随着时间不停的改变,起初的表结构设计已经满足不了如今的需求,这时你是不是想那就加字段呗!加字段也是个艺术活,接下来由本文的主人咔咔给你吹. 试想一下这个场景 事务A在执行一个非常大的查询 事务 ...

  4. 学习ASP.NET Core Razor 编程系列十四——文件上传功能(二)

    学习ASP.NET Core Razor 编程系列目录 学习ASP.NET Core Razor 编程系列一 学习ASP.NET Core Razor 编程系列二——添加一个实体 学习ASP.NET ...

  5. Netty实战十四之案例研究(一)

    1.Droplr——构建移动服务 Bruno de Carvalho,首席架构师 在Droplr,我们在我的基础设施的核心部分.从我们的API服务器到辅助服务的各个部分都使用了Netty. 这是一个关 ...

  6. shiro实战系列(十四)之配置

    Shiro 被设计成能够在任何环境下工作,从最简单的命令行应用程序到最大的的企业群集应用.由于环境的多样性,使得许多配置机制适用于它的配置. 一. 许多配置选项 Shiro的SecurityManag ...

  7. SpringCloud系列十四:实现容错的手段

    1. 回顾 前面已用Eureka实现了微服务的注册与发现,Ribbon实现了客户端侧的负载均衡,Feign实现了声明式的API调用. 2. 实现容错的手段 如果服务提供者响应非常慢,那么消费者对提供者 ...

  8. WPF入门教程系列十四——依赖属性(四)

    六.依赖属性回调.验证及强制值 我们通过下面的这幅图,简单介绍一下WPF属性系统对依赖属性操作的基本步骤: 借用一个常见的图例,介绍一下WPF属性系统对依赖属性操作的基本步骤: 第一步,确定Base ...

  9. Pandas系列(四)-文本数据处理

    内容目录 1. 为什么要用str属性 2. 替换和分割 3. 提取子串 3.1 提取第一个匹配的子串 3.2 匹配所有子串 3.3 测试是否包含子串 3.4 生成哑变量 3.5 方法摘要 一.为什么要 ...

  10. 单点登录(十四)-----实战-----cas5.0.x登录mongodb验证方式常规的四种加密的思考和分析

    我们在上一篇文章中已经讲解了cas4.2.X登录启用mongodb验证方式 单点登录(十三)-----实战-----cas4.2.X登录启用mongodb验证方式完整流程 但是密码是明文存储的,也就是 ...

随机推荐

  1. Yii2.0调用sql server存储过程并获取返回值

    1.首先展示创建sql server存储过程的语句,创建一个简单的存储过程,测试用. SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE P ...

  2. Redhat安装Oracle 11g (转)

    1.1     安装前准备 1.1.1     修改操作系统核心参数 在Root用户下执行以下步骤: 1.1.1.1 修改/etc/security/limits.conf文件 输入命令:vi /et ...

  3. LeetCode算法题-Longest Harmonious Subsequence(Java实现)

    这是悦乐书的第270次更新,第284篇原创 01 看题和准备 今天介绍的是LeetCode算法题中Easy级别的第136题(顺位题号是594).我们定义一个和谐数组是一个数组,其最大值和最小值之间的差 ...

  4. AI 强化学习

    强化学习(reinforcement learning,简称RL), agent policy state action 目标  最大化累计reward 参考链接: https://en.wikipe ...

  5. UI Automator 常用 API 整理

    主要类: import android.support.test.uiautomator.UiDevice; 作用:设备封装类,测试过程中获取设备信息和设备交互. import android.sup ...

  6. Linux笔记-ps -aux的结果解析

    参考: https://blog.csdn.net/flyingleo1981/article/details/7739490 ps 的参数说明ps 提供了很多的选项参数,常用的有以下几个: l 长格 ...

  7. Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.

    SpringBoot启动时的异常信息如下: "C:\Program Files\Java\jdk1.8.0_161\bin\java" ......... com.fangxing ...

  8. SQL 无法连接服务器

    错误信息:provider:SQL Network Interfaces, error:52-无法定位 LOCA Database Runtime 安装.请验证SQL Server Express是否 ...

  9. sqlalchemy常用

    一.SQLAlchemy 创建表 from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Colu ...

  10. mysql 5.7 json

    项目中使用的mysql5.6数据库,数据库表一张表中存的字段为blob类型的json串数据.性能压测中涉及该json串处理效率比较低,开发人员提到mysql5.7版本后json串提供了原生态的json ...