当前位置:网站首页>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()
边栏推荐
- Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
- Hands on deep learning pytorch version exercise solution - 2.5 automatic differentiation
- Rewrite Boston house price forecast task (using paddlepaddlepaddle)
- Leetcode skimming ---367
- 多层感知机(PyTorch)
- Class-Variant Margin Normalized Softmax Loss for Deep Face Recognition
- Ind wks first week
- The story of a 30-year-old tester struggling, even lying flat is extravagant
- Linear regression of introduction to deep learning (pytorch)
- Leetcode刷题---283
猜你喜欢
C project - dormitory management system (1)
What did I read in order to understand the to do list
Tensorflow - tensorflow Foundation
Install yolov3 (Anaconda)
六、MySQL之数据定义语言(一)
GAOFAN Weibo app
Are there any other high imitation projects
Powshell's set location: unable to find a solution to the problem of accepting actual parameters
7、 Data definition language of MySQL (2)
Multilayer perceptron (pytorch)
随机推荐
High imitation wechat
Leetcode刷题---704
Ut2012 learning notes
mysql5.7安装和配置教程(图文超详细版)
Hands on deep learning pytorch version exercise answer - 2.2 preliminary knowledge / data preprocessing
Leetcode刷题---367
Leetcode skimming ---202
Leetcode刷题---75
Hands on deep learning pytorch version exercise solution-3.3 simple implementation of linear regression
Ut2016 learning notes
神经网络入门之矩阵计算(Pytorch)
GAOFAN Weibo app
Linear regression of introduction to deep learning (pytorch)
Drop out (pytoch)
Ut2014 supplementary learning notes
Content type ‘application/x-www-form-urlencoded;charset=UTF-8‘ not supported
Leetcode刷题---852
Ut2013 learning notes
[LZY learning notes -dive into deep learning] math preparation 2.5-2.7
Multilayer perceptron (pytorch)