Tutorials

This is a guide to many pandas tutorials, geared mainly for new users. Internal Guides pandas own 10 Minutes to pandas More complex recipes are in the Cookbook pandas Cookbook The goal of this cookbook (by Julia Evans) is to give you some concrete examples for getting started with pandas. These are examples with real-world data, and all the bugs and weirdness that that entails. Here are links to the v0.1 release. For an up-to-date table of contents, see the pandas-cookbook GitHub repository

Comparison with SAS

For potential users coming from SAS this page is meant to demonstrate how different SAS operations would be performed in pandas. If you?re new to pandas, you might want to first read through 10 Minutes to pandas to familiarize yourself with the library. As is customary, we import pandas and numpy as follows: In [1]: import pandas as pd In [2]: import numpy as np Note Throughout this tutorial, the pandas DataFrame will be displayed by calling df.head(), which displays the first N (default 5)

MultiIndex.reorder_levels()

MultiIndex.reorder_levels(order) [source] Rearrange levels using input order. May not drop or duplicate levels

MultiIndex.item()

MultiIndex.item() [source] return the first element of the underlying data as a python scalar

Series.put()

Series.put(*args, **kwargs) [source] Applies the put method to its values attribute if it has one. See also numpy.ndarray.put

Series.str.len()

Series.str.len() [source] Compute length of each string in the Series/Index. Returns: lengths : Series/Index of integer values

DatetimeIndex.values

DatetimeIndex.values return the underlying data as an ndarray

Essential Basic Functionality

Here we discuss a lot of the essential functionality common to the pandas data structures. Here?s how to create some of the objects used in the examples from the previous section: In [1]: index = pd.date_range('1/1/2000', periods=8) In [2]: s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e']) In [3]: df = pd.DataFrame(np.random.randn(8, 3), index=index, ...: columns=['A', 'B', 'C']) ...: In [4]: wp = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', '

Panel4D.sort_values()

Panel4D.sort_values(by, axis=0, ascending=True, inplace=False, kind='quicksort', na_position='last') [source]

Resampler.ffill()

Resampler.ffill(limit=None) [source] Forward fill the values Parameters: limit : integer, optional limit of how many values to fill See also Series.fillna, DataFrame.fillna