当前位置:网站首页>Classification (data consolidation and grouping aggregation)
Classification (data consolidation and grouping aggregation)
2022-07-03 10:38:00 【weixin_ forty-three million six hundred and ninety-one thousand】
First read in the data ,
Ideas : Reconstruct an all 0 Array of , The column name is classification , If a classification appears in a piece of data , let 0 Turn into 1
List of statistical classifications df['Genre"].str.split(',').tolist()
df.join()# Merge data with the same index ,
Data consolidation .
Merge row indexes .join(index)
Column index for merging merge(coloms)
df3=pd.DatsFrame(np.zeros(3,3)),columns=list("fax"))
df1.merge(df3,on="a") according to a Column index for operation
merge Combine
df3.loc[1,"a"]=1
merge outer Combine nan completion
merge left On the left nan completion
merge right On the right ,nan completion
Data packet aggregation :df.groupby()
DataFrameGroupby It can be traversed
Index and composite index
Index methods and properties print(grouped1.index)
df.index=['x','y']
df1.reindex['a','f']# To reset index
df.set_index("a")# Specify a column as an index
df.set_index("a”,unique)
matplotlib Map the top 10% of the total number of stores in the country
Prepare the data df.hroupby=(by=Country').count().sort_values(ascending=False)[:10])
_x=data1.index()
边栏推荐
- 2-program logic
- Leetcode刷题---217
- 实战篇:Oracle 数据库标准版(SE)转换为企业版(EE)
- 七、MySQL之数据定义语言(二)
- Jetson TX2 刷机
- Secure in mysql8.0 under Windows_ file_ Priv is null solution
- Ut2014 supplementary learning notes
- Ut2014 learning notes
- 8、 Transaction control language of MySQL
- Hands on deep learning pytorch version exercise answer - 2.2 preliminary knowledge / data preprocessing
猜你喜欢
Weight decay (pytorch)
8、 Transaction control language of MySQL
一步教你溯源【钓鱼邮件】的IP地址
A complete answer sheet recognition system
Multi-Task Feature Learning for Knowledge Graph Enhanced Recommendation
Hands on deep learning pytorch version exercise solution - 2.4 calculus
A super cool background permission management system
[LZY learning notes -dive into deep learning] math preparation 2.1-2.4
Data preprocessing - Data Mining 1
Stroke prediction: Bayesian
随机推荐
[graduation season] the picture is rich, and frugality is easy; Never forget chaos and danger in peace.
Leetcode skimming ---1385
Leetcode skimming ---189
Leetcode skimming ---977
Judging the connectivity of undirected graphs by the method of similar Union and set search
神经网络入门之矩阵计算(Pytorch)
Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
High imitation Netease cloud music
Synchronous vs asynchronous
Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
Leetcode刷题---35
Ut2013 learning notes
Hands on deep learning pytorch version exercise solution - 3.1 linear regression
熵值法求权重
An open source OA office automation system
Type de contenu « Application / X - www - form - urlencoded; Charset = utf - 8 'not supported
神经网络入门之预备知识(PyTorch)
Julia1.0
深度学习入门之自动求导(Pytorch)
ECMAScript -- "ES6 syntax specification # Day1