diff --git a/pandas/core/reshape.py b/pandas/core/reshape.py index adc824544b8c7..8595e2a91906d 100644 --- a/pandas/core/reshape.py +++ b/pandas/core/reshape.py @@ -745,11 +745,13 @@ def make_axis_dummies(frame, axis='minor', transform=None): Parameters ---------- + frame : DataFrame axis : {'major', 'minor'}, default 'minor' transform : function, default None Function to apply to axis labels first. For example, to - get "day of week" dummies in a time series regression you might - call: + get "day of week" dummies in a time series regression + you might call:: + make_axis_dummies(panel, axis='major', transform=lambda d: d.weekday()) Returns diff --git a/pandas/stats/math.py b/pandas/stats/math.py index 1b926fa5ee7c0..579d49edb8511 100644 --- a/pandas/stats/math.py +++ b/pandas/stats/math.py @@ -50,13 +50,14 @@ def newey_west(m, max_lags, nobs, df, nw_overlap=False): Parameters ---------- - m: (N x K) - max_lags: int - nobs: int + m : (N x K) + max_lags : int + nobs : int Number of observations in model - df: int + df : int Degrees of freedom in explanatory variables - nw_overlap: boolean + nw_overlap : boolean, default False + Assume data is overlapping Returns ------- diff --git a/pandas/stats/moments.py b/pandas/stats/moments.py index e53916f113e1b..b104c70da9494 100644 --- a/pandas/stats/moments.py +++ b/pandas/stats/moments.py @@ -137,7 +137,8 @@ def rolling_count(arg, window, freq=None, center=False, time_rule=None): Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- rolling_count : type of caller @@ -268,7 +269,8 @@ def _rolling_moment(arg, window, func, minp, axis=0, freq=None, Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- y : type of input @@ -540,7 +542,8 @@ def rolling_quantile(arg, window, quantile, min_periods=None, freq=None, Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- y : type of input argument @@ -569,7 +572,8 @@ def rolling_apply(arg, window, func, min_periods=None, freq=None, Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- y : type of input argument @@ -604,7 +608,9 @@ def rolling_window(arg, window=None, win_type=None, min_periods=None, Whether the label should correspond with center of window mean : boolean, default True If True computes weighted mean, else weighted sum - + time_rule : Legacy alias for freq + axis : {0, 1}, default 0 + Returns ------- y : type of input argument @@ -729,7 +735,8 @@ def expanding_count(arg, freq=None, center=False, time_rule=None): Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- expanding_count : type of caller @@ -752,7 +759,8 @@ def expanding_quantile(arg, quantile, min_periods=1, freq=None, Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- y : type of input argument @@ -816,7 +824,8 @@ def expanding_apply(arg, func, min_periods=1, freq=None, center=False, Frequency to conform to before computing statistic center : boolean, default False Whether the label should correspond with center of window - + time_rule : Legacy alias for freq + Returns ------- y : type of input argument diff --git a/pandas/stats/ols.py b/pandas/stats/ols.py index 9ecf5c6ab715f..4d0ae7ce0e897 100644 --- a/pandas/stats/ols.py +++ b/pandas/stats/ols.py @@ -28,12 +28,19 @@ class OLS(object): Parameters ---------- - y: Series - x: Series, DataFrame, dict of Series - intercept: bool + y : Series + x : Series, DataFrame, dict of Series + intercept : bool True if you want an intercept. - nw_lags: None or int + weights : array-like, optional + 1d array of weights. If you supply 1/W then the variables are pre- + multiplied by 1/sqrt(W). If no weights are supplied the default value + is 1 and WLS reults are the same as OLS. + nw_lags : None or int Number of Newey-West lags. + nw_overlap : boolean, default False + Assume data is overlapping when computing Newey-West estimator + """ _panel_model = False @@ -593,16 +600,24 @@ class MovingOLS(OLS): Parameters ---------- - y: Series - x: Series, DataFrame, or dict of Series - intercept: bool - True if you want an intercept. - nw_lags: None or int - Number of Newey-West lags. - window_type: {'full sample', 'rolling', 'expanding'} + y : Series + x : Series, DataFrame, or dict of Series + weights : array-like, optional + 1d array of weights. If None, equivalent to an unweighted OLS. + window_type : {'full sample', 'rolling', 'expanding'} Default expanding - window: int + window : int size of window (for rolling/expanding OLS) + min_periods : int + Threshold of non-null data points to require. + If None, defaults to size of window. + intercept : bool + True if you want an intercept. + nw_lags : None or int + Number of Newey-West lags. + nw_overlap : boolean, default False + Assume data is overlapping when computing Newey-West estimator + """ def __init__(self, y, x, weights=None, window_type='expanding', window=None, min_periods=None, intercept=True, @@ -1246,10 +1261,12 @@ def _filter_data(lhs, rhs, weights=None): Parameters ---------- - lhs: Series + lhs : Series Dependent variable in the regression. - rhs: dict, whose values are Series, DataFrame, or dict + rhs : dict, whose values are Series, DataFrame, or dict Explanatory variables of the regression. + weights : array-like, optional + 1d array of weights. If None, equivalent to an unweighted OLS. Returns ------- diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index 2fdad439219e2..223e127223195 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -165,6 +165,7 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False, Parameters ---------- + frame : DataFrame alpha : amount of transparency applied figsize : a tuple (width, height) in inches ax : Matplotlib axis object @@ -172,6 +173,7 @@ def scatter_matrix(frame, alpha=0.5, figsize=None, ax=None, grid=False, diagonal : pick between 'kde' and 'hist' for either Kernel Density Estimation or Histogram plot in the diagonal + marker : Matplotlib marker type, default '.' kwds : other plotting keyword arguments To be passed to scatter function @@ -365,10 +367,17 @@ def normalize(series): def andrews_curves(data, class_column, ax=None, samples=200): """ Parameters: - data: A DataFrame containing data to be plotted, preferably - normalized to (0.0, 1.0). - class_column: Name of the column containing class names. - samples: Number of points to plot in each curve. + ----------- + data : DataFrame + Data to be plotted, preferably normalized to (0.0, 1.0) + class_column : Name of the column containing class names + ax : matplotlib axes object, default None + samples : Number of points to plot in each curve + + Returns: + -------- + ax: Matplotlib axis object + """ from math import sqrt, pi, sin, cos import matplotlib.pyplot as plt @@ -1475,6 +1484,7 @@ def plot_frame(frame=None, x=None, y=None, subplots=False, sharex=True, Parameters ---------- + frame : DataFrame x : label or position, default None y : label or position, default None Allows plotting of one column versus another @@ -1675,8 +1685,11 @@ def boxplot(data, column=None, by=None, ax=None, fontsize=None, Can be any valid input to groupby by : string or sequence Column in the DataFrame to group by + ax : Matplotlib axis object, optional fontsize : int or string rot : label rotation angle + figsize : A tuple (width, height) in inches + grid : Setting this to True will show the grid kwds : other plotting keyword arguments to be passed to matplotlib boxplot function @@ -1779,7 +1792,19 @@ def format_date_labels(ax, rot): def scatter_plot(data, x, y, by=None, ax=None, figsize=None, grid=False, **kwargs): """ + Make a scatter plot from two DataFrame columns + Parameters + ---------- + data : DataFrame + x : Column name for the x-axis values + y : Column name for the y-axis values + ax : Matplotlib axis object + figsize : A tuple (width, height) in inches + grid : Setting this to True will show the grid + kwargs : other plotting keyword arguments + To be passed to scatter function + Returns ------- fig : matplotlib.Figure @@ -1818,6 +1843,11 @@ def hist_frame( Parameters ---------- + data : DataFrame + column : string or sequence + If passed, will be used to limit data to a subset of columns + by : object, optional + If passed, then used to form histograms for separate groups grid : boolean, default True Whether to show axis grid lines xlabelsize : int, default None @@ -1956,6 +1986,7 @@ def boxplot_frame_groupby(grouped, subplots=True, column=None, fontsize=None, Parameters ---------- + grouped : Grouped DataFrame subplots : * ``False`` - no subplots will be used * ``True`` - create a subplot for each group @@ -1963,6 +1994,8 @@ def boxplot_frame_groupby(grouped, subplots=True, column=None, fontsize=None, Can be any valid input to groupby fontsize : int or string rot : label rotation angle + grid : Setting this to True will show the grid + figsize : A tuple (width, height) in inches kwds : other plotting keyword arguments to be passed to matplotlib boxplot function @@ -2157,15 +2190,19 @@ def _subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, Dict with keywords passed to the add_subplot() call used to create each subplots. - fig_kw : dict - Dict with keywords passed to the figure() call. Note that all keywords - not recognized above will be automatically included here. - - ax : Matplotlib axis object, default None + ax : Matplotlib axis object, optional secondary_y : boolean or sequence of ints, default False If True then y-axis will be on the right + data : DataFrame, optional + If secondary_y is a sequence, data is used to select columns. + + fig_kw : Other keyword arguments to be passed to the figure() call. + Note that all keywords not recognized above will be + automatically included here. + + Returns: fig, ax : tuple