这篇文章写得更好:http://wittyfans.com/coding/%E5%88%A9%E7%94%A8Pandas%E5%88%86%E6%9E%90%E7%BE%8E%E5%9B%BD%E4%BA%A4%E8%AD%A6%E5%BC%80%E6%94%BE%E7%9A%84%E6%90%9C%E6%9F%A5%E6%95%B0%E6%8D%AE.html import pandas as pd import matplotlib.pyplot as plt #需要声明才能在notebo…
numpy array 过滤后的数组,索引值从 0 开始. pandas Series 过滤后的 Series ,保持原来的索引,原来索引是几,就是几. 什么意思呢,来看个栗子: import numpy as np import pandas as pd # 有两个相同的数组,一个是pd Series 一个是 np array a = pd.Series([1, 2, 3, 4]) c = np.array([1, 2, 3, 4]) # 通过索引数组来过滤数组 d = a[a>3] e =…
This would allow chaining operations like: pd.read_csv('imdb.txt') .sort(columns='year') .filter(lambda x: x['year']>1990) # <---this is missing in Pandas .to_csv('filtered.csv') For current alternatives see: http://stackoverflow.com/questions/11869…