.groupby.SeriesGroupBy.rolling ](pandas.core.groupby.SeriesGroupBy.rolling.html)
    * [ pandas.core.groupby.SeriesGroupBy.sample ](pandas.core.groupby.SeriesGroupBy.sample.html)
    * [ pandas.core.groupby.SeriesGroupBy.sem ](pandas.core.groupby.SeriesGroupBy.sem.html)
    * [ pandas.core.groupby.SeriesGroupBy.shift ](pandas.core.groupby.SeriesGroupBy.shift.html)
    * [ pandas.core.groupby.SeriesGroupBy.size ](pandas.core.groupby.SeriesGroupBy.size.html)
    * [ pandas.core.groupby.SeriesGroupBy.skew ](pandas.core.groupby.SeriesGroupBy.skew.html)
    * [ pandas.core.groupby.SeriesGroupBy.std ](pandas.core.groupby.SeriesGroupBy.std.html)
    * [ pandas.core.groupby.SeriesGroupBy.sum ](pandas.core.groupby.SeriesGroupBy.sum.html)
    * [ pandas.core.groupby.SeriesGroupBy.var ](pandas.core.groupby.SeriesGroupBy.var.html)
    * [ pandas.core.groupby.SeriesGroupBy.tail ](pandas.core.groupby.SeriesGroupBy.tail.html)
    * [ pandas.core.groupby.SeriesGroupBy.take ](pandas.core.groupby.SeriesGroupBy.take.html)
    * [ pandas.core.groupby.SeriesGroupBy.value_counts ](pandas.core.groupby.SeriesGroupBy.value_counts.html)
    * [ pandas.core.groupby.DataFrameGroupBy.boxplot ](pandas.core.groupby.DataFrameGroupBy.boxplot.html)
    * [ pandas.core.groupby.DataFrameGroupBy.hist ](pandas.core.groupby.DataFrameGroupBy.hist.html)
    * [ pandas.core.groupby.SeriesGroupBy.hist ](pandas.core.groupby.SeriesGroupBy.hist.html)
    * [ pandas.core.groupby.DataFrameGroupBy.plot ](pandas.core.groupby.DataFrameGroupBy.plot.html)
    * [ pandas.core.groupby.SeriesGroupBy.plot ](pandas.core.groupby.SeriesGroupBy.plot.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ GroupBy ](../groupby.html)
  * pandas.core.... 

#  pandas.core.groupby.SeriesGroupBy.ohlc  #

SeriesGroupBy.  ohlc  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/groupby/groupby.py#L3486-L3574) #

    

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

For multiple groupings, the result index will be a MultiIndex

Returns  :

    

DataFrame

    

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

Examples

For SeriesGroupBy:

    
    
    >>> lst = ['SPX', 'CAC', 'SPX', 'CAC', 'SPX', 'CAC', 'SPX', 'CAC',]
    >>> ser = pd.Series([3.4, 9.0, 7.2, 5.2, 8.8, 9.4, 0.1, 0.5], index=lst)
    >>> ser
    SPX     3.4
    CAC     9.0
    SPX     7.2
    CAC     5.2
    SPX     8.8
    CAC     9.4
    SPX     0.1
    CAC     0.5
    dtype: float64
    >>> ser.groupby(level=0).ohlc()
         open  high  low  close
    CAC   9.0   9.4  0.5    0.5
    SPX   3.4   8.8  0.1    0.1
    

For DataFrameGroupBy:

    
    
    >>> data = {2022: [1.2, 2.3, 8.9, 4.5, 4.4, 3, 2 , 1],
    ...         2023: [3.4, 9.0, 7.2, 5.2, 8.8, 9.4, 8.2, 1.0]}
    >>> df = pd.DataFrame(data, index=['SPX', 'CAC', 'SPX', 'CAC',
    ...                   'SPX', 'CAC', 'SPX', 'CAC'])
    >>> df
         2022  2023
    SPX   1.2   3.4
    CAC   2.3   9.0
    SPX   8.9   7.2
    CAC   4.5   5.2
    SPX   4.4   8.8
    CAC   3.0   9.4
    SPX   2.0   8.2
    CAC   1.0   1.0
    >>> df.groupby(level=0).ohlc()
        2022                 2023
        open high  low close open high  low close
    CAC  2.3  4.5  1.0   1.0  9.0  9.4  1.0   1.0
    SPX  1.2  8.9  1.2   2.0  3.4  8.8  3.4   8.2
    

For Resampler:

    
    
    >>> 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',
    ..