<利用Python进行数据分析> Note 3- pandas, series, reshape, reindex, lambda, apply, value_counts

Pandas:

In [1]: from pandas import Series, DataFrame

In[2]: import pandas as pd

Series:

Get values and index of the series

Function: reshape()

reindex()

调用Series的reindex 将会根据新索引进行重排。如果某个索引值当前不存在,就引入缺失值:

reindex的(插值)method选项 

ffill : 前向填充值

bfill: 后向填充值

lambda 创建一个匿名函数。冒号前面是传入参数,后面是一个处理传入参数的单行表达式。DataFrame的apply方法将函数应用到由各列或行所形成的一堆数组上。

value_counts用于计算一个Series中各值出现的频率 

Count the amount of values in DataFrame by appling pandas.value_counts to apply

原文地址:https://www.cnblogs.com/XinZhou-Annie/p/7115007.html