Python for Data Analysis: Data Wrangling with Pandas, NumPy, and IPython
Rate it:
2%
Flag icon
Windows To get started on Windows, download the EPDFree installer from http://www.enthought.com, which should be an MSI installer named like epd_free-7.3-1-win-x86.msi. Run the installer and accept the default installation location C:\Python27. If you had previously installed Python in this location, you may want to delete it manually first (or using Add/Remove Programs). Next, you need to verify that Python has been successfully added to the system path and that there are no conflicts with any prior-installed Python versions. First, open a command prompt by going to the Start Menu and ...more
This highlight has been truncated due to consecutive passage length restrictions.
Ankit Jain
installer
3%
Flag icon
Data files and related material for each chapter are hosted as a git repository on GitHub: http://github.com/pydata/pydata-book
26%
Flag icon
To sort by multiple columns, pass a list of names: In [182]: frame.sort_index(by=['a', 'b'])
30%
Flag icon
pd.read_csv('ch06/csv_mindex.csv', index_col=['key1', 'key2'])
31%
Flag icon
Table 6-2. read_csv /read_table function arguments Argument Description path String indicating filesystem location, URL, or file-like object sep or delimiter Character sequence or regular expression to use to split fields in each row header Row number to use as column names. Defaults to 0 (first row), but should be None if there is no header row index_col Column numbers or names to use as the row index in the result. Can be a single name/number or a list of them for a hierarchical index names List of column names for result, combine with header=None skiprows Number of rows at beginning of file ...more
This highlight has been truncated due to consecutive passage length restrictions.
31%
Flag icon
data.to_csv(sys.stdout, sep='|')
34%
Flag icon
In [23]: pd.merge(df3, df4, left_on='lkey', right_on='rkey') Out[23]:
35%
Flag icon
pd.merge(df1, df2, on='key', how='left')
35%
Flag icon
Table 7-1. merge function arguments Argument Description left DataFrame to be merged on the left side right DataFrame to be merged on the right side how One of 'inner', 'outer', 'left' or 'right'. 'inner' by default on Column names to join on. Must be found in both DataFrame objects. If not specified and no other join keys given, will use the intersection of the column names in left and right as the join keys left_on Columns in left DataFrame to use as join keys right_on Analogous to left_on for left DataFrame left_index Use row index in left as its join key (or keys, if a MultiIndex) ...more
38%
Flag icon
data['animal'] = data['food'].map(str.lower).map(meat_to_animal)