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

Series.dt.weekday

Series.dt.weekday The day of the week with Monday=0, Sunday=6

Panel4D.ffill()

Panel4D.ffill(axis=None, inplace=False, limit=None, downcast=None) [source] Synonym for NDFrame.fillna(method=?ffill?)

MultiIndex.sort_values()

MultiIndex.sort_values(return_indexer=False, ascending=True) [source] Return sorted copy of Index

MultiIndex.get_value()

MultiIndex.get_value(series, key) [source]

TimedeltaIndex.asi8

TimedeltaIndex.asi8

Panel4D.get_ftype_counts()

Panel4D.get_ftype_counts() [source] Return the counts of ftypes in this object.

DataFrame.corrwith()

DataFrame.corrwith(other, axis=0, drop=False) [source] Compute pairwise correlation between rows or columns of two DataFrame objects. Parameters: other : DataFrame axis : {0 or ?index?, 1 or ?columns?}, default 0 0 or ?index? to compute column-wise, 1 or ?columns? for row-wise drop : boolean, default False Drop missing indices from result, default returns union of all Returns: correls : Series

DataFrame.to_records()

DataFrame.to_records(index=True, convert_datetime64=True) [source] Convert DataFrame to record array. Index will be put in the ?index? field of the record array if requested Parameters: index : boolean, default True Include index in resulting record array, stored in ?index? field convert_datetime64 : boolean, default True Whether to convert the index to datetime.datetime if it is a DatetimeIndex Returns: y : recarray