这篇教程30写得很实用,希望能帮到您。 前言: Pandas 是 Python 中最广泛使用的数据分析和操作库。它提供了许多功能和方法,可以加快 「数据分析」 和 「预处理」 步骤。
为了更好的学习 Python ,我将以客户流失数据集为例,分享 「30」 个在数据分析过程中最常使用的函数和方法。 数据如下所示: import numpy as npimport pandas as pddf = pd.read_csv("Churn_Modelling.csv")print(df.shape)df.columns 结果输出: (10000, 14) Index(['RowNumber', 'CustomerId', 'Surname', 'CreditScore', 'Geography','Gender', 'Age', 'Tenure', 'Balance', 'NumOfProducts', 'HasCrCard','IsActiveMember', 'EstimatedSalary', 'Exited'],dtype='object')
1.删除列
df.drop(['RowNumber', 'CustomerId', 'Surname', 'CreditScore'], axis=1, inplace=True)print(df[:2])print(df.shape) 结果输出: 深入了解Python二维直方图 python
|