Comparison with SQL

Since many potential pandas users have some familiarity with SQL, this page is meant to provide some examples of how various SQL operations would be performed using 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 Most of the examples will utilize the tips dataset found within pandas tests. We?ll rea

Panel.mask()

Panel.mask(cond, other=nan, inplace=False, axis=None, level=None, try_cast=False, raise_on_error=True) [source] Return an object of same shape as self and whose corresponding entries are from self where cond is False and otherwise are from other. Parameters: cond : boolean NDFrame, array or callable If cond is callable, it is computed on the NDFrame and should return boolean NDFrame or array. The callable must not change input NDFrame (though pandas doesn?t check it). New in version 0.18

DataFrame.size

DataFrame.size number of elements in the NDFrame

Series.ftypes

Series.ftypes return if the data is sparse|dense

DatetimeIndex.holds_integer()

DatetimeIndex.holds_integer() [source]

CategoricalIndex.is_integer()

CategoricalIndex.is_integer() [source]

Panel.to_sparse()

Panel.to_sparse(*args, **kwargs) [source] NOT IMPLEMENTED: do not call this method, as sparsifying is not supported for Panel objects and will raise an error. Convert to SparsePanel

TimedeltaIndex.sortlevel()

TimedeltaIndex.sortlevel(level=None, ascending=True, sort_remaining=None) [source] For internal compatibility with with the Index API Sort the Index. This is for compat with MultiIndex Parameters: ascending : boolean, default True False to sort in descending order level, sort_remaining are compat parameters Returns: sorted_index : Index

pandas.to_datetime()

pandas.to_datetime(*args, **kwargs) [source] Convert argument to datetime. Parameters: arg : string, datetime, list, tuple, 1-d array, Series errors : {?ignore?, ?raise?, ?coerce?}, default ?raise? If ?raise?, then invalid parsing will raise an exception If ?coerce?, then invalid parsing will be set as NaT If ?ignore?, then invalid parsing will return the input dayfirst : boolean, default False Specify a date parse order if arg is str or its list-likes. If True, parses dates with the d

DatetimeIndex.is_year_end

DatetimeIndex.is_year_end Logical indicating if last day of year (defined by frequency)