注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
在Udemy上的这门 Data Analysis with Pandas and Python。目前完成了前四个session的学习,包括Series 和 DataFrames 1,2,3. 感觉讲师讲的比较详细,虽然视频发布时间在3年前,但绝大部分的代码都可以在最新的pandas版本上实现。由于这里不能上传.ipynb格式的文件,那就在这里简要列出各session的知识点吧。
先列一部分。。持续更新。。看大家需要到多detail的程度?
Series:
1. create series from python list/dictionary
pd.Series(list)
pd.Series(dic)
pd.Series(data= ,index= )
# index do not have to be unique
2. Series Attributes and Methods
s.values s.index s.dtype s.is_unique s.size s.name
s.sum() s.product() s.mean() s.median() s.mode() s.describe()
s.head() s.tail()
len(s) type(s) sorted(s) list(s) dict(s)
# only methods need ()
3. sort values
s.sort_values(ascending = True, inplace = False)
4. Extract values by index position
s[5] s[[1,3,5]] s[1:5] s[:5]
5. get the index postion of max/min values
s.idxmax() s.idxmin()
6. s.value_counts()
7. apply
#perform an operation on every single value withing the Series
s.apply(function)
s.apply(lambda : )
DataFrames
p = pd.read_csv(" ", )
p.index p.values p.shape p.dtypes p.columns p.info() p.get_dtype_counts() p['column'].value_counts()
p.dropna(how="all")
p.dropna(subset=[])
p.fillna(0, inplace = True)
p['column'].nuique()
p.sort_values('column', ascending = True)
|