Skip to main content
`Ctrl`+`K`

# pandas.api.typing.Resampler.ohlc

final Resampler.ohlc()

  Compute open, high, low and close values of a group, excluding missing values.

  Returns:
    DataFrame

      Open, high, low and close values within each group.

  See also

  `DataFrame.agg`

    Aggregate using one or more operations over the specified axis.

  `DataFrame.resample`

    Resample time-series data.

  `DataFrame.groupby`

    Group DataFrame using a mapper or by a Series of columns.

  Examples

      >>> ser = pd.Series(
      ...     [1, 3, 2, 4, 3, 5],
      ...     index=pd.DatetimeIndex(
      ...         [
      ...             "2023-01-01",
      ...             "2023-01-10",
      ...             "2023-01-15",
      ...             "2023-02-01",
      ...             "2023-02-10",
      ...             "2023-02-15",
      ...         ]
      ...     ),
      ... )
      >>> ser.resample("MS").ohlc()
                  open  high  low  close
      2023-01-01     1     3    1      2
      2023-02-01     4     5    3      5