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

DataFrame.axes

DataFrame.axes Return a list with the row axis labels and column axis labels as the only members. They are returned in that order.

DataFrame.to_panel()

DataFrame.to_panel() [source] Transform long (stacked) format (DataFrame) into wide (3D, Panel) format. Currently the index of the DataFrame must be a 2-level MultiIndex. This may be generalized later Returns: panel : Panel

Resampler.prod()

Resampler.prod(_method='prod', *args, **kwargs) [source] Compute prod of group values See also pandas.Series.groupby, pandas.DataFrame.groupby, pandas.Panel.groupby

DataFrame.icol()

DataFrame.icol(i) [source] DEPRECATED. Use .iloc[:, i] instead