time_series_countplot

time_series_countplot(data: DataFrame, column: str, ax: Optional[Axes] = None, ts_type: str = 'point', ts_freq: str = 'auto', trend_line: Optional[str] = None, date_labels: Optional[str] = None, date_breaks: Optional[str] = None, span: float = 0.75, ci_level: float = 0.95, lower_quantile: float = 0, upper_quantile: float = 1) Axes

Plots a times series plot of datetime column where the y axis is counts of observations aggregated at a provided temporal frequency. Assumes that each row in the dataframe is a single event and not already aggregated.

Parameters
  • data – pandas DataFrame to perform EDA on

  • column – A string matching a column in the data

  • ax – matplotlib axes generated from blank ggplot to plot onto. If specified, must also specify fig

  • ts_type – ‘line’ plots a line graph while ‘point’ plots points for observations

  • ts_freq

    String describing the frequency at which to aggregate data in one of two formats:

    • A pandas offset string.

    • A human readable string in the same format passed to date breaks (e.g. “4 months”)

    Default is to attempt to intelligently determine a good aggregation frequency.

  • trend_line – Trend line to plot over data. Default is to plot no trend line. Other options available are same as those available in plotnine’s stat_smooth

  • date_labels – strftime date formatting string that will be used to set the format of the x axis tick labels

  • date_breaks – Date breaks string in form ‘{interval} {period}’. Interval must be an integer and period must be a time period ranging from seconds to years. (e.g. ‘1 year’, ‘3 minutes’)

  • span – Span parameter to determine amount of smoothing for loess

  • ci_level – Confidence level determining how wide to plot confidence intervals for smoothing.

  • lower_quantile – Lower quantile to filter data above

  • upper_quantile – Upper quantile to filter data below

Returns

Matplotlib axes with time series drawn

Example

(Source code, png, hires.png, pdf)

../_images/intedact-univariate_plots-time_series_countplot-1.png