famafrench.utils.get_statsTable¶
-
famafrench.utils.
get_statsTable
(dType, dFreq, df, dates_as_index=True, ptiles=None)[source]¶ Construct detailed tables with summary statistics.
- Parameters
dType (str) –
Dataset type of the portfolios. Possible choices are:
Returns
Factors
NumFirms
Characs
dFreq (str) –
Observation frequency of the portfolios. Possible choices are:
D
: dailyW
: weeklyM
: monthlyQ
: quarterly (3-months)A
: annual
df (pandas.DataFrame) – Dataset w/ portfolio returns (which may include factor returns), number of firms in each portfolio, or average anomaly portfolio characteristics for a given portfolio sorting strategy.
dates_as_index (bool) – Flag determining whether
df
has apandas.DatetimeIndex
index (dates_as_index = True
). Otherwise,dates_as_index = False
.ptiles (list, float, default None) – List of percentiles (in decimal format) included as part of output results. If
None
, thenptiles = [0.01, 0.1, 0.25, 0.5, 0.75, 0.9, 0.99]
.
- Returns
statsTable –
Summary statistics of the dataset including the following:
number of observations
pandas.DataFrame.count()
sample mean
pandas.DataFrame.mean()
sample standard deviation
pandas.DataFrame.std()
sample min
pandas.DataFrame.min()
sample max
pandas.DataFrame.max()
sample skewness
pandas.DataFrame.skew()
sample kurtosis
pandas.DataFrame.kurtosis()
sample mean absolute deviation
pandas.DataFrame.mad()
sample percentiles
numpy.percentile()
If
dates_as_index = True
, then the table also includes the starting and ending date for each observation type.- Return type