pandas笔记

https://www.youtube.com/watch?v=yzIMircGU5I&list=PL5-da3qGB5ICCsgW1MxlZ0Hq8LL5U3u9y&index=1 read a tabular data file cols = ['col1', 'col2'] pd.read_table(path, sep='|', headers=None, names=cols) pd.head() # first five rows commands end with parentheses df.describe() #show mean, std, max, min... rename columns df.rename(columns = {'old_col_name':'new_col_name'}, inplace=True) cols = new_col_list df.columns = cols df.columns = df.columns.str.replace(' ', '_') remove columns df.drop('col', axis=1, inplace=True) df.drop([rows], axis=0, inplace=True) sort df['col'].sort_values(ascending=False) # series df.sort_values('col') # return dataframe df.sort_values(['col1', 'col2']) filter rows of a pandas DataFrame...