Python数据分析博文汇总
 * Pandas重复值处理函数drop_duplicates() 
<https://blog.csdn.net/W_weiying/article/details/80231896>
 * Pandas数据库缺失值处理函数dropna 
<https://blog.csdn.net/W_weiying/article/details/80232127>
 * Pandas中slice函数字段抽取 
<https://blog.csdn.net/W_weiying/article/details/80235581>
 * python数据分析-DataFrame数据框基本知识 
<https://blog.csdn.net/W_weiying/article/details/80241530>
 * Pandas数据库数据抽取 <https://blog.csdn.net/W_weiying/article/details/80390194>
 * Numpy.random.randint()函数用法及源码 
<https://blog.csdn.net/W_weiying/article/details/80390416>
 * Pandas.concat()函数用法及源码 
<https://blog.csdn.net/W_weiying/article/details/80390463>
 * Pandas数据框列合并详解 <https://blog.csdn.net/W_weiying/article/details/80393524>
 * Pandas.merge()函数用法及源码 
<https://blog.csdn.net/W_weiying/article/details/80394036>
 * Pandas之数据框框运算 <https://blog.csdn.net/W_weiying/article/details/80394243>
 * Pandas之数据标准化 <https://blog.csdn.net/W_weiying/article/details/80396470>
 * Pandas.cut函数用法及源码 <https://blog.csdn.net/W_weiying/article/details/80396638>
 * python数据框空格值处理 <https://blog.csdn.net/W_weiying/article/details/80235367>
 * Pandas.split()函数用法及源码 
<https://blog.csdn.net/W_weiying/article/details/80235961>
数据分组:根据数据分析对象的特征,按照一定的数值指标,把数据分析对象划分为不同的区间部分来进行研究,以揭示其内在的联系和规律性。
函数用法:cut(series, bins, right=True, 
labels=NULL), right=True表示分组右边闭合,right=False表示分组左边闭合,
labels表示分组的自定义标签。
import pandas; from pandas import read_csv; df = 
read_csv("E:\\pythonlearning\\datacode\\firstpart\\4\\4.15\\data.csv", 
sep='|'); bins = [min(df.cost)-1, 20, 40, 60, 80, 100, max(df.cost)+1]; labels 
= ['20以下', '20到40', '40到60', '60到80', '80到100', '100以上']; pandas.cut(df.cost, 
bins)#默认右边闭合 df1=pandas.cut(df.cost, bins, right=False)#左边闭合 
df1=pandas.cut(df.cost, bins, right=False, labels=labels) df['New']=df1
运行前三行得:
运行四、五、六行得:
运行四、五、七行得:
运行第八行得:
源代码:https://download.csdn.net/download/w_weiying/10427108
热门工具 换一换