mteb/BrightProStackoverflowRetrieval huggingface dataset:
x.from_fields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.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)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.set_codes  #

MultiIndex.  set_codes  (  _ codes  _ , _ *  _ , _ level  =  None  _ , _
verify_integrity  =  True  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L1126-L1188) #

    

Set new codes on MultiIndex. Defaults to returning new index.

Parameters  :

    

**codes** sequence or list of sequence

    

New codes to apply.

**level** int, level name, or sequence of int/level names (default None)

    

Level(s) to set (None for all levels).

**verify_integrity** bool, default True

    

If True, checks that levels and codes are compatible.

Returns  :

    

new index (of same type and classâ¦etc) or None

    

The same type as the caller or None if ` inplace=True  ` .

Examples

    
    
    >>> idx = pd.MultiIndex.from_tuples(
    ...     [(1, "one"), (1, "two"), (2, "one"), (2, "two")], names=["foo", "bar"]
    ... )
    >>> idx
    MultiIndex([(1, 'one'),
        (1, 'two'),
        (2, 'one'),
        (2, 'two')],
       names=['foo', 'bar'])
    
    
    
    >>> idx.set_codes([[1, 0, 1, 0], [0, 0, 1, 1]])
    MultiIndex([(2, 'one'),
                (1, 'one'),
                (2, 'two'),
                (1, 'two')],
               names=['foo', 'bar'])
    >>> idx.set_codes([1, 0, 1, 0], level=0)
    MultiIndex([(2, 'one'),
                (1, 'two'),
                (2, 'one'),
                (1, 'two')],
               names=['foo', 'bar'])
    >>> idx.set_codes([0, 0, 1, 1], level='bar')
    MultiIndex([(1, 'one'),
                (1, 'one'),
                (2, 'two'),
                (2, 'two')],
               names=['foo', 'bar'])
    >>> idx.set_codes([[1, 0, 1, 0], [0, 0, 1, 1]], level=[0, 1])
    MultiIndex([(2, 'one'),
                (1, 'one'),
                (2, 'two'),
                (1, 'two')],
               names=['foo', 'bar'])
    

[ __ previous  pandas.MultiIndex.set_levels
](pandas.MultiIndex.set_levels.html "previous page") [ next
pandas.MultiIndex.to_frame  __ ](pandas.MultiIndex.to_frame.html "next page")

__ On this page

  * ` MultiIndex.set_codes()  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.set_codes.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
dIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.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)
  * __
  * [ pandas.PeriodIndex ](pandas.PeriodIndex.html)
  * pandas.Perio... 

#  pandas.PeriodIndex.hour  #

_ property  _ PeriodIndex.  hour  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/extension.py#L67-L75) #

    

The hour of the period.

Examples

    
    
    >>> idx = pd.PeriodIndex(["2023-01-01 10:00", "2023-01-01 11:00"], freq='h')
    >>> idx.hour
    Index([10, 11], dtype='int64')
    

[ __ previous  pandas.PeriodIndex.freqstr  ](pandas.PeriodIndex.freqstr.html
"previous page") [ next  pandas.PeriodIndex.is_leap_year  __
](pandas.PeriodIndex.is_leap_year.html "next page")

__ On this page

  * ` PeriodIndex.hour  `

[ __ Show Source
](../../_sources/reference/api/pandas.PeriodIndex.hour.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
Index.from_fields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.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)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.get_loc  #

MultiIndex.  get_loc  (  _ key  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L2982-L3102) #

    

Get location for a label or a tuple of labels.

The location is returned as an integer/slice or boolean mask.

Parameters  :

    

**key** label or tuple of labels (one for each level)

    
Returns  :

    

int, slice object or boolean mask

    

If the key is past the lexsort depth, the return may be a boolean mask array,
otherwise it is always a slice or int.

See also

[ ` Index.get_loc  ` ](pandas.Index.get_loc.html#pandas.Index.get_loc
"pandas.Index.get_loc")

    

The get_loc method for (single-level) index.

` MultiIndex.slice_locs  `

    

Get slice location given start label(s) and end label(s).

[ ` MultiIndex.get_locs  `
](pandas.MultiIndex.get_locs.html#pandas.MultiIndex.get_locs
"pandas.MultiIndex.get_locs")

    

Get location for a label/slice/list/mask or a sequence of such.

Notes

The key cannot be a slice, list of same-level labels, a boolean mask, or a
sequence of such. If you want to use those, use [ ` MultiIndex.get_locs()  `
](pandas.MultiIndex.get_locs.html#pandas.MultiIndex.get_locs
"pandas.MultiIndex.get_locs") instead.

Examples

    
    
    >>> mi = pd.MultiIndex.from_arrays([list('abb'), list('def')])
    
    
    
    >>> mi.get_loc('b')
    slice(1, 3, None)
    
    
    
    >>> mi.get_loc(('b', 'e'))
    1
    

[ __ previous  pandas.MultiIndex.get_indexer
](pandas.MultiIndex.get_indexer.html "previous page") [ next
pandas.MultiIndex.get_locs  __ ](pandas.MultiIndex.get_locs.html "next page")

__ On this page

  * ` MultiIndex.get_loc()  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.get_loc.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
nals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.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)
  * __
  * [ pandas.PeriodIndex ](pandas.PeriodIndex.html)
  * pandas.Perio... 

#  pandas.PeriodIndex.is_leap_year  #

_ property  _ PeriodIndex.  is_leap_year  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/extension.py#L67-L75) #

    

Logical indicating if the date belongs to a leap year.

Examples

    
    
    >>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
    >>> idx.is_leap_year
    array([False,  True, False])
    

[ __ previous  pandas.PeriodIndex.hour  ](pandas.PeriodIndex.hour.html
"previous page") [ next  pandas.PeriodIndex.minute  __
](pandas.PeriodIndex.minute.html "next page")

__ On this page

  * ` PeriodIndex.is_leap_year  `

[ __ Show Source
](../../_sources/reference/api/pandas.PeriodIndex.is_leap_year.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
dex.from_fields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.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)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.levshape  #

_ property  _ MultiIndex.  levshape  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L1062-L1076) #

    

A tuple with the length of each level.

Examples

    
    
    >>> mi = pd.MultiIndex.from_arrays([['a'], ['b'], ['c']])
    >>> mi
    MultiIndex([('a', 'b', 'c')],
               )
    >>> mi.levshape
    (1, 1, 1)
    

[ __ previous  pandas.MultiIndex.nlevels  ](pandas.MultiIndex.nlevels.html
"previous page") [ next  pandas.MultiIndex.dtypes  __
](pandas.MultiIndex.dtypes.html "next page")

__ On this page

  * ` MultiIndex.levshape  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.levshape.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
om_fields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.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)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.from_tuples  #

_ classmethod  _ MultiIndex.  from_tuples  (  _ tuples  _ , _ sortorder  =
None  _ , _ names  =  None  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L545-L624) #

    

Convert list of tuples to MultiIndex.

Parameters  :

    

**tuples** list / sequence of tuple-likes

    

Each tuple is the index of one row/column.

**sortorder** int or None

    

Level of sortedness (must be lexicographically sorted by that level).

**names** list / sequence of str, optional

    

Names for the levels in the index.

Returns  :

    

MultiIndex

    

See also

[ ` MultiIndex.from_arrays  `
](pandas.MultiIndex.from_arrays.html#pandas.MultiIndex.from_arrays
"pandas.MultiIndex.from_arrays")

    

Convert list of arrays to MultiIndex.

[ ` MultiIndex.from_product  `
](pandas.MultiIndex.from_product.html#pandas.MultiIndex.from_product
"pandas.MultiIndex.from_product")

    

Make a MultiIndex from cartesian product of iterables.

[ ` MultiIndex.from_frame  `
](pandas.MultiIndex.from_frame.html#pandas.MultiIndex.from_frame
"pandas.MultiIndex.from_frame")

    

Make a MultiIndex from a DataFrame.

Examples

    
    
    >>> tuples = [(1, 'red'), (1, 'blue'),
    ...           (2, 'red'), (2, 'blue')]
    >>> pd.MultiIndex.from_tuples(tuples, names=('number', 'color'))
    MultiIndex([(1,  'red'),
                (1, 'blue'),
                (2,  'red'),
                (2, 'blue')],
               names=['number', 'color'])
    

[ __ previous  pandas.MultiIndex.from_arrays
](pandas.MultiIndex.from_arrays.html "previous page") [ next
pandas.MultiIndex.from_product  __ ](pandas.MultiIndex.from_product.html "next
page")

__ On this page

  * ` MultiIndex.from_tuples()  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.from_tuples.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
* [ 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)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.infer_objects  #

DataFrame.  infer_objects  (  _ copy  =  None  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L6831-L6890) #

    

Attempt to infer better dtypes for object columns.

Attempts soft conversion of object-dtyped columns, leaving non-object and
unconvertible columns unchanged. The inference rules are the same as during
normal Series/DataFrame construction.

Parameters  :

    

**copy** bool, default True

    

Whether to make a copy for non-object or non-inferable columns or Series.

Note

The  copy  keyword will change behavior in pandas 3.0. [ Copy-on-Write
](https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html) will be
enabled by default, which means that all methods with a  copy  keyword will
use a lazy copy mechanism to defer the copy and ignore the  copy  keyword. The
copy  keyword will be removed in a future version of pandas.

You can already get the future behavior and improvements through enabling copy
on write ` pd.options.mode.copy_on_write  =  True  `

Returns  :

    

same type as input object

    

See also

[ ` to_datetime  ` ](pandas.to_datetime.html#pandas.to_datetime
"pandas.to_datetime")

    

Convert argument to datetime.

[ ` to_timedelta  ` ](pandas.to_timedelta.html#pandas.to_timedelta
"pandas.to_timedelta")

    

Convert argument to timedelta.

[ ` to_numeric  ` ](pandas.to_numeric.html#pandas.to_numeric
"pandas.to_numeric")

    

Convert argument to numeric type.

[ ` convert_dtypes  `
](pandas.DataFrame.convert_dtypes.html#pandas.DataFrame.convert_dtypes
"pandas.DataFrame.convert_dtypes")

    

Convert argument to best possible dtype.

Examples

    
    
    >>> df = pd.DataFrame({"A": ["a", 1, 2, 3]})
    >>> df = df.iloc[1:]
    >>> df
       A
    1  1
    2  2
    3  3
    
    
    
    >>> df.dtypes
    A    object
    dtype: object
    
    
    
    >>> df.infer_objects().dtypes
    A    int64
    dtype: object
    

[ __ previous  pandas.DataFrame.convert_dtypes
](pandas.DataFrame.convert_dtypes.html "previous page") [ next
pandas.DataFrame.copy  __ ](pandas.DataFrame.copy.html "next page")

__ On this page

  * ` DataFrame.infer_objects()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.infer_objects.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
.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)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.nunique  #

DataFrame.  nunique  (  _ axis  =  0  _ , _ dropna  =  True  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L11798-L11836) #

    

Count number of distinct elements in specified axis.

Return Series with number of distinct elements. Can ignore NaN values.

Parameters  :

    

**axis** {0 or âindexâ, 1 or âcolumnsâ}, default 0

    

The axis to use. 0 or âindexâ for row-wise, 1 or âcolumnsâ for column-
wise.

**dropna** bool, default True

    

Donât include NaN in the counts.

Returns  :

    

Series

    

See also

[ ` Series.nunique  ` ](pandas.Series.nunique.html#pandas.Series.nunique
"pandas.Series.nunique")

    

Method nunique for Series.

[ ` DataFrame.count  ` ](pandas.DataFrame.count.html#pandas.DataFrame.count
"pandas.DataFrame.count")

    

Count non-NA cells for each column or row.

Examples

    
    
    >>> df = pd.DataFrame({'A': [4, 5, 6], 'B': [4, 1, 1]})
    >>> df.nunique()
    A    3
    B    2
    dtype: int64
    
    
    
    >>> df.nunique(axis=1)
    0    1
    1    2
    2    2
    dtype: int64
    

[ __ previous  pandas.DataFrame.var  ](pandas.DataFrame.var.html "previous
page") [ next  pandas.DataFrame.value_counts  __
](pandas.DataFrame.value_counts.html "next page")

__ On this page

  * ` DataFrame.nunique()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.nunique.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
upby.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)
  * [ DataFrame ](../frame.html)
  * pandas.DataFrame.iat 

#  pandas.DataFrame.iat  #

_ property  _ DataFrame.  iat  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexing.py#L676-L722) #

    

Access a single value for a row/column pair by integer position.

Similar to ` iloc  ` , in that both provide integer-based lookups. Use ` iat
` if you only need to get or set a single value in a DataFrame or Series.

Raises  :

    

IndexError

    

When integer position is out of bounds.

See also

[ ` DataFrame.at  ` ](pandas.DataFrame.at.html#pandas.DataFrame.at
"pandas.DataFrame.at")

    

Access a single value for a row/column label pair.

[ ` DataFrame.loc  ` ](pandas.DataFrame.loc.html#pandas.DataFrame.loc
"pandas.DataFrame.loc")

    

Access a group of rows and columns by label(s).

[ ` DataFrame.iloc  ` ](pandas.DataFrame.iloc.html#pandas.DataFrame.iloc
"pandas.DataFrame.iloc")

    

Access a group of rows and columns by integer position(s).

Examples

    
    
    >>> df = pd.DataFrame([[0, 2, 3], [0, 4, 1], [10, 20, 30]],
    ...                   columns=['A', 'B', 'C'])
    >>> df
        A   B   C
    0   0   2   3
    1   0   4   1
    2  10  20  30
    

Get value at specified row/column pair

    
    
    >>> df.iat[1, 2]
    1
    

Set value at specified row/column pair

    
    
    >>> df.iat[1, 2] = 10
    >>> df.iat[1, 2]
    10
    

Get value within a series

    
    
    >>> df.loc[0].iat[1]
    2
    

[ __ previous  pandas.DataFrame.at  ](pandas.DataFrame.at.html "previous
page") [ next  pandas.DataFrame.loc  __ ](pandas.DataFrame.loc.html "next
page")

__ On this page

  * ` DataFrame.iat  `

[ __ Show Source ](../../_sources/reference/api/pandas.DataFrame.iat.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
.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)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.at_time  #

DataFrame.  at_time  (  _ time  _ , _ asof  =  False  _ , _ axis  =  None  _ )
[ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/generic.py#L9240-L9295) #

    

Select values at particular time of day (e.g., 9:30AM).

Parameters  :

    

**time** datetime.time or str

    

The values to select.

**axis** {0 or âindexâ, 1 or âcolumnsâ}, default 0

    

For  Series  this parameter is unused and defaults to 0.

Returns  :

    

Series or DataFrame

    
Raises  :

    

TypeError

    

If the index is not a [ ` DatetimeIndex  `
](pandas.DatetimeIndex.html#pandas.DatetimeIndex "pandas.DatetimeIndex")

See also

[ ` between_time  `
](pandas.DataFrame.between_time.html#pandas.DataFrame.between_time
"pandas.DataFrame.between_time")

    

Select values between particular times of the day.

[ ` first  ` ](pandas.DataFrame.first.html#pandas.DataFrame.first
"pandas.DataFrame.first")

    

Select initial periods of time series based on a date offset.

[ ` last  ` ](pandas.DataFrame.last.html#pandas.DataFrame.last
"pandas.DataFrame.last")

    

Select final periods of time series based on a date offset.

[ ` DatetimeIndex.indexer_at_time  `
](pandas.DatetimeIndex.indexer_at_time.html#pandas.DatetimeIndex.indexer_at_time
"pandas.DatetimeIndex.indexer_at_time")

    

Get just the index locations for values at particular time of the day.

Examples

    
    
    >>> i = pd.date_range('2018-04-09', periods=4, freq='12h')
    >>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
    >>> ts
                         A
    2018-04-09 00:00:00  1
    2018-04-09 12:00:00  2
    2018-04-10 00:00:00  3
    2018-04-10 12:00:00  4
    
    
    
    >>> ts.at_time('12:00')
                         A
    2018-04-09 12:00:00  2
    2018-04-10 12:00:00  4
    

[ __ previous  pandas.DataFrame.align  ](pandas.DataFrame.align.html "previous
page") [ next  pandas.DataFrame.between_time  __
](pandas.DataFrame.between_time.html "next page")

__ On this page

  * ` DataFrame.at_time()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.at_time.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.