title stringlengths 5 65 | summary stringlengths 5 98.2k | context stringlengths 9 121k | path stringlengths 10 84 ⌀ |
|---|---|---|---|
pandas arrays, scalars, and data types | pandas arrays, scalars, and data types | Objects#
For most data types, pandas uses NumPy arrays as the concrete
objects contained with a Index, Series, or
DataFrame.
For some data types, pandas extends NumPy’s type system. String aliases for these types
can be found at dtypes.
Kind of Data
pandas Data Type
Scalar
Array
TZ-aware datetime
DatetimeTZD... | reference/arrays.html |
pandas.tseries.offsets.Milli.delta | pandas.tseries.offsets.Milli.delta | Milli.delta#
| reference/api/pandas.tseries.offsets.Milli.delta.html |
pandas.tseries.offsets.Nano.freqstr | `pandas.tseries.offsets.Nano.freqstr`
Return a string representing the frequency.
```
>>> pd.DateOffset(5).freqstr
'<5 * DateOffsets>'
``` | Nano.freqstr#
Return a string representing the frequency.
Examples
>>> pd.DateOffset(5).freqstr
'<5 * DateOffsets>'
>>> pd.offsets.BusinessHour(2).freqstr
'2BH'
>>> pd.offsets.Nano().freqstr
'N'
>>> pd.offsets.Nano(-3).freqstr
'-3N'
| reference/api/pandas.tseries.offsets.Nano.freqstr.html |
pandas.tseries.offsets.BusinessMonthBegin.__call__ | `pandas.tseries.offsets.BusinessMonthBegin.__call__`
Call self as a function. | BusinessMonthBegin.__call__(*args, **kwargs)#
Call self as a function.
| reference/api/pandas.tseries.offsets.BusinessMonthBegin.__call__.html |
pandas.Timestamp.date | `pandas.Timestamp.date`
Return date object with same year, month and day. | Timestamp.date()#
Return date object with same year, month and day.
| reference/api/pandas.Timestamp.date.html |
pandas.RangeIndex.from_range | `pandas.RangeIndex.from_range`
Create RangeIndex from a range object. | classmethod RangeIndex.from_range(data, name=None, dtype=None)[source]#
Create RangeIndex from a range object.
Returns
RangeIndex
| reference/api/pandas.RangeIndex.from_range.html |
pandas.tseries.offsets.QuarterBegin.nanos | pandas.tseries.offsets.QuarterBegin.nanos | QuarterBegin.nanos#
| reference/api/pandas.tseries.offsets.QuarterBegin.nanos.html |
pandas.tseries.offsets.Minute.freqstr | `pandas.tseries.offsets.Minute.freqstr`
Return a string representing the frequency.
Examples
```
>>> pd.DateOffset(5).freqstr
'<5 * DateOffsets>'
``` | Minute.freqstr#
Return a string representing the frequency.
Examples
>>> pd.DateOffset(5).freqstr
'<5 * DateOffsets>'
>>> pd.offsets.BusinessHour(2).freqstr
'2BH'
>>> pd.offsets.Nano().freqstr
'N'
>>> pd.offsets.Nano(-3).freqstr
'-3N'
| reference/api/pandas.tseries.offsets.Minute.freqstr.html |
pandas.tseries.offsets.CustomBusinessHour.is_month_end | `pandas.tseries.offsets.CustomBusinessHour.is_month_end`
Return boolean whether a timestamp occurs on the month end.
Examples
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_end(ts)
False
``` | CustomBusinessHour.is_month_end()#
Return boolean whether a timestamp occurs on the month end.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_end(ts)
False
| reference/api/pandas.tseries.offsets.CustomBusinessHour.is_month_end.html |
pandas.PeriodIndex.quarter | `pandas.PeriodIndex.quarter`
The quarter of the date. | property PeriodIndex.quarter[source]#
The quarter of the date.
| reference/api/pandas.PeriodIndex.quarter.html |
pandas.tseries.offsets.BusinessMonthEnd.nanos | pandas.tseries.offsets.BusinessMonthEnd.nanos | BusinessMonthEnd.nanos#
| reference/api/pandas.tseries.offsets.BusinessMonthEnd.nanos.html |
pandas.Series.cat.add_categories | `pandas.Series.cat.add_categories`
Add new categories.
```
>>> c = pd.Categorical(['c', 'b', 'c'])
>>> c
['c', 'b', 'c']
Categories (2, object): ['b', 'c']
``` | Series.cat.add_categories(*args, **kwargs)[source]#
Add new categories.
new_categories will be included at the last/highest place in the
categories and will be unused directly after this call.
Parameters
new_categoriescategory or list-like of categoryThe new categories to be included.
inplacebool, default FalseWheth... | reference/api/pandas.Series.cat.add_categories.html |
Group by: split-apply-combine | Group by: split-apply-combine | By “group by” we are referring to a process involving one or more of the following
steps:
Splitting the data into groups based on some criteria.
Applying a function to each group independently.
Combining the results into a data structure.
Out of these, the split step is the most straightforward. In fact, in many
situ... | user_guide/groupby.html |
pandas.read_orc | `pandas.read_orc`
Load an ORC object from the file path, returning a DataFrame. | pandas.read_orc(path, columns=None, **kwargs)[source]#
Load an ORC object from the file path, returning a DataFrame.
New in version 1.0.0.
Parameters
pathstr, path object, or file-like objectString, path object (implementing os.PathLike[str]), or file-like
object implementing a binary read() function. The string co... | reference/api/pandas.read_orc.html |
pandas.tseries.offsets.DateOffset.apply | pandas.tseries.offsets.DateOffset.apply | DateOffset.apply()#
| reference/api/pandas.tseries.offsets.DateOffset.apply.html |
pandas.tseries.offsets.FY5253.rollforward | `pandas.tseries.offsets.FY5253.rollforward`
Roll provided date forward to next offset only if not on offset. | FY5253.rollforward()#
Roll provided date forward to next offset only if not on offset.
Returns
TimeStampRolled timestamp if not on offset, otherwise unchanged timestamp.
| reference/api/pandas.tseries.offsets.FY5253.rollforward.html |
pandas.tseries.offsets.SemiMonthBegin.day_of_month | pandas.tseries.offsets.SemiMonthBegin.day_of_month | SemiMonthBegin.day_of_month#
| reference/api/pandas.tseries.offsets.SemiMonthBegin.day_of_month.html |
pandas.core.groupby.GroupBy.count | `pandas.core.groupby.GroupBy.count`
Compute count of group, excluding missing values. | final GroupBy.count()[source]#
Compute count of group, excluding missing values.
Returns
Series or DataFrameCount of values within each group.
See also
Series.groupbyApply a function groupby to a Series.
DataFrame.groupbyApply a function groupby to each row or column of a DataFrame.
| reference/api/pandas.core.groupby.GroupBy.count.html |
pandas.Series.dt.isocalendar | `pandas.Series.dt.isocalendar`
Calculate year, week, and day according to the ISO 8601 standard.
```
>>> ser = pd.to_datetime(pd.Series(["2010-01-01", pd.NaT]))
>>> ser.dt.isocalendar()
year week day
0 2009 53 5
1 <NA> <NA> <NA>
>>> ser.dt.isocalendar().week
0 53
1 <NA>
Name: week, dtype: UInt32... | Series.dt.isocalendar()[source]#
Calculate year, week, and day according to the ISO 8601 standard.
New in version 1.1.0.
Returns
DataFrameWith columns year, week and day.
See also
Timestamp.isocalendarFunction return a 3-tuple containing ISO year, week number, and weekday for the given Timestamp object.
date... | reference/api/pandas.Series.dt.isocalendar.html |
pandas.MultiIndex.swaplevel | `pandas.MultiIndex.swaplevel`
Swap level i with level j.
```
>>> mi = pd.MultiIndex(levels=[['a', 'b'], ['bb', 'aa']],
... codes=[[0, 0, 1, 1], [0, 1, 0, 1]])
>>> mi
MultiIndex([('a', 'bb'),
('a', 'aa'),
('b', 'bb'),
('b', 'aa')],
)
>>> mi.swaplevel(0, 1... | MultiIndex.swaplevel(i=- 2, j=- 1)[source]#
Swap level i with level j.
Calling this method does not change the ordering of the values.
Parameters
iint, str, default -2First level of index to be swapped. Can pass level name as string.
Type of parameters can be mixed.
jint, str, default -1Second level of index to be s... | reference/api/pandas.MultiIndex.swaplevel.html |
pandas.core.groupby.GroupBy.median | `pandas.core.groupby.GroupBy.median`
Compute median of groups, excluding missing values. | final GroupBy.median(numeric_only=_NoDefault.no_default)[source]#
Compute median of groups, excluding missing values.
For multiple groupings, the result index will be a MultiIndex
Parameters
numeric_onlybool, default TrueInclude only float, int, boolean columns. If None, will attempt to use
everything, then use only ... | reference/api/pandas.core.groupby.GroupBy.median.html |
pandas.api.extensions.ExtensionArray._concat_same_type | `pandas.api.extensions.ExtensionArray._concat_same_type`
Concatenate multiple array of this dtype. | classmethod ExtensionArray._concat_same_type(to_concat)[source]#
Concatenate multiple array of this dtype.
Parameters
to_concatsequence of this type
Returns
ExtensionArray
| reference/api/pandas.api.extensions.ExtensionArray._concat_same_type.html |
pandas.tseries.offsets.Week.is_year_start | `pandas.tseries.offsets.Week.is_year_start`
Return boolean whether a timestamp occurs on the year start.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_year_start(ts)
True
``` | Week.is_year_start()#
Return boolean whether a timestamp occurs on the year start.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_year_start(ts)
True
| reference/api/pandas.tseries.offsets.Week.is_year_start.html |
pandas.Series.quantile | `pandas.Series.quantile`
Return value at the given quantile.
```
>>> s = pd.Series([1, 2, 3, 4])
>>> s.quantile(.5)
2.5
>>> s.quantile([.25, .5, .75])
0.25 1.75
0.50 2.50
0.75 3.25
dtype: float64
``` | Series.quantile(q=0.5, interpolation='linear')[source]#
Return value at the given quantile.
Parameters
qfloat or array-like, default 0.5 (50% quantile)The quantile(s) to compute, which can lie in range: 0 <= q <= 1.
interpolation{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}This optional parameter specifies th... | reference/api/pandas.Series.quantile.html |
pandas.tseries.offsets.BusinessHour.normalize | pandas.tseries.offsets.BusinessHour.normalize | BusinessHour.normalize#
| reference/api/pandas.tseries.offsets.BusinessHour.normalize.html |
pandas.api.types.is_float_dtype | `pandas.api.types.is_float_dtype`
Check whether the provided array or dtype is of a float dtype.
```
>>> is_float_dtype(str)
False
>>> is_float_dtype(int)
False
>>> is_float_dtype(float)
True
>>> is_float_dtype(np.array(['a', 'b']))
False
>>> is_float_dtype(pd.Series([1, 2]))
False
>>> is_float_dtype(pd.Index([1, 2.]))... | pandas.api.types.is_float_dtype(arr_or_dtype)[source]#
Check whether the provided array or dtype is of a float dtype.
Parameters
arr_or_dtypearray-like or dtypeThe array or dtype to check.
Returns
booleanWhether or not the array or dtype is of a float dtype.
Examples
>>> is_float_dtype(str)
False
>>> is_float... | reference/api/pandas.api.types.is_float_dtype.html |
pandas.DataFrame.items | `pandas.DataFrame.items`
Iterate over (column name, Series) pairs.
```
>>> df = pd.DataFrame({'species': ['bear', 'bear', 'marsupial'],
... 'population': [1864, 22000, 80000]},
... index=['panda', 'polar', 'koala'])
>>> df
species population
panda bear 1864
polar b... | DataFrame.items()[source]#
Iterate over (column name, Series) pairs.
Iterates over the DataFrame columns, returning a tuple with
the column name and the content as a Series.
Yields
labelobjectThe column names for the DataFrame being iterated over.
contentSeriesThe column entries belonging to each label, as a Series.... | reference/api/pandas.DataFrame.items.html |
pandas.tseries.offsets.Micro.is_quarter_start | `pandas.tseries.offsets.Micro.is_quarter_start`
Return boolean whether a timestamp occurs on the quarter start.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_quarter_start(ts)
True
``` | Micro.is_quarter_start()#
Return boolean whether a timestamp occurs on the quarter start.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_quarter_start(ts)
True
| reference/api/pandas.tseries.offsets.Micro.is_quarter_start.html |
pandas.tseries.offsets.CustomBusinessDay.is_month_end | `pandas.tseries.offsets.CustomBusinessDay.is_month_end`
Return boolean whether a timestamp occurs on the month end.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_end(ts)
False
``` | CustomBusinessDay.is_month_end()#
Return boolean whether a timestamp occurs on the month end.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_end(ts)
False
| reference/api/pandas.tseries.offsets.CustomBusinessDay.is_month_end.html |
pandas.tseries.offsets.BusinessDay.offset | `pandas.tseries.offsets.BusinessDay.offset`
Alias for self._offset. | BusinessDay.offset#
Alias for self._offset.
| reference/api/pandas.tseries.offsets.BusinessDay.offset.html |
pandas.tseries.offsets.BYearEnd.month | pandas.tseries.offsets.BYearEnd.month | BYearEnd.month#
| reference/api/pandas.tseries.offsets.BYearEnd.month.html |
pandas.Series.sparse.npoints | `pandas.Series.sparse.npoints`
The number of non- fill_value points.
Examples
```
>>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
>>> s.npoints
3
``` | Series.sparse.npoints[source]#
The number of non- fill_value points.
Examples
>>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
>>> s.npoints
3
| reference/api/pandas.Series.sparse.npoints.html |
pandas.Categorical.__array__ | `pandas.Categorical.__array__`
The numpy array interface.
A numpy array of either the specified dtype or,
if dtype==None (default), the same dtype as
categorical.categories.dtype. | Categorical.__array__(dtype=None)[source]#
The numpy array interface.
Returns
numpy.arrayA numpy array of either the specified dtype or,
if dtype==None (default), the same dtype as
categorical.categories.dtype.
| reference/api/pandas.Categorical.__array__.html |
pandas.core.window.rolling.Rolling.skew | `pandas.core.window.rolling.Rolling.skew`
Calculate the rolling unbiased skewness.
Include only float, int, boolean columns. | Rolling.skew(numeric_only=False, **kwargs)[source]#
Calculate the rolling unbiased skewness.
Parameters
numeric_onlybool, default FalseInclude only float, int, boolean columns.
New in version 1.5.0.
**kwargsFor NumPy compatibility and will not have an effect on the result.
Deprecated since version 1.5.0.
Retu... | reference/api/pandas.core.window.rolling.Rolling.skew.html |
pandas.notnull | `pandas.notnull`
Detect non-missing values for an array-like object.
```
>>> pd.notna('dog')
True
``` | pandas.notnull(obj)[source]#
Detect non-missing values for an array-like object.
This function takes a scalar or array-like object and indicates
whether values are valid (not missing, which is NaN in numeric
arrays, None or NaN in object arrays, NaT in datetimelike).
Parameters
objarray-like or object valueObject to ... | reference/api/pandas.notnull.html |
pandas.DataFrame.dot | `pandas.DataFrame.dot`
Compute the matrix multiplication between the DataFrame and other.
```
>>> df = pd.DataFrame([[0, 1, -2, -1], [1, 1, 1, 1]])
>>> s = pd.Series([1, 1, 2, 1])
>>> df.dot(s)
0 -4
1 5
dtype: int64
``` | DataFrame.dot(other)[source]#
Compute the matrix multiplication between the DataFrame and other.
This method computes the matrix product between the DataFrame and the
values of an other Series, DataFrame or a numpy array.
It can also be called using self @ other in Python >= 3.5.
Parameters
otherSeries, DataFrame or ... | reference/api/pandas.DataFrame.dot.html |
pandas.io.formats.style.Styler.format_index | `pandas.io.formats.style.Styler.format_index`
Format the text display value of index labels or column headers.
```
>>> df = pd.DataFrame([[1, 2, 3]], columns=[2.0, np.nan, 4.0])
>>> df.style.format_index(axis=1, na_rep='MISS', precision=3)
2.000 MISS 4.000
0 1 2 3
``` | Styler.format_index(formatter=None, axis=0, level=None, na_rep=None, precision=None, decimal='.', thousands=None, escape=None, hyperlinks=None)[source]#
Format the text display value of index labels or column headers.
New in version 1.4.0.
Parameters
formatterstr, callable, dict or NoneObject to define how values a... | reference/api/pandas.io.formats.style.Styler.format_index.html |
pandas.tseries.offsets.Milli.apply_index | Milli.apply_index()#
Vectorized apply of DateOffset to DatetimeIndex.
Deprecated since version 1.1.0: Use offset + dtindex instead.
Parameters
indexDatetimeIndex
Returns
DatetimeIndex
Raises
NotImplementedErrorWhen the specific offset subclass does not have a vectorized
implementation.
| reference/api/pandas.tseries.offsets.Milli.apply_index.html | null |
pandas.Series.skew | `pandas.Series.skew`
Return unbiased skew over requested axis.
Normalized by N-1. | Series.skew(axis=_NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]#
Return unbiased skew over requested axis.
Normalized by N-1.
Parameters
axis{index (0)}Axis for the function to be applied on.
For Series this parameter is unused and defaults to 0.
skipnabool, default TrueExclude ... | reference/api/pandas.Series.skew.html |
pandas.Period.day_of_year | `pandas.Period.day_of_year`
Return the day of the year.
This attribute returns the day of the year on which the particular
date occurs. The return value ranges between 1 to 365 for regular
years and 1 to 366 for leap years.
```
>>> period = pd.Period("2015-10-23", freq='H')
>>> period.day_of_year
296
>>> period = pd.Pe... | Period.day_of_year#
Return the day of the year.
This attribute returns the day of the year on which the particular
date occurs. The return value ranges between 1 to 365 for regular
years and 1 to 366 for leap years.
Returns
intThe day of year.
See also
Period.dayReturn the day of the month.
Period.day_of_weekR... | reference/api/pandas.Period.day_of_year.html |
pandas.DatetimeIndex.month | `pandas.DatetimeIndex.month`
The month as January=1, December=12.
```
>>> datetime_series = pd.Series(
... pd.date_range("2000-01-01", periods=3, freq="M")
... )
>>> datetime_series
0 2000-01-31
1 2000-02-29
2 2000-03-31
dtype: datetime64[ns]
>>> datetime_series.dt.month
0 1
1 2
2 3
dtype: int64
``` | property DatetimeIndex.month[source]#
The month as January=1, December=12.
Examples
>>> datetime_series = pd.Series(
... pd.date_range("2000-01-01", periods=3, freq="M")
... )
>>> datetime_series
0 2000-01-31
1 2000-02-29
2 2000-03-31
dtype: datetime64[ns]
>>> datetime_series.dt.month
0 1
1 2
2 3
dty... | reference/api/pandas.DatetimeIndex.month.html |
pandas.Index.set_value | `pandas.Index.set_value`
Fast lookup of value from 1-dimensional ndarray.
Deprecated since version 1.0. | final Index.set_value(arr, key, value)[source]#
Fast lookup of value from 1-dimensional ndarray.
Deprecated since version 1.0.
Notes
Only use this if you know what you’re doing.
| reference/api/pandas.Index.set_value.html |
pandas.ExcelWriter.cur_sheet | `pandas.ExcelWriter.cur_sheet`
Current sheet for writing.
Deprecated since version 1.5.0. | property ExcelWriter.cur_sheet[source]#
Current sheet for writing.
Deprecated since version 1.5.0.
| reference/api/pandas.ExcelWriter.cur_sheet.html |
pandas.api.extensions.register_dataframe_accessor | `pandas.api.extensions.register_dataframe_accessor`
Register a custom accessor on DataFrame objects.
```
>>> pd.Series(['a', 'b']).dt
Traceback (most recent call last):
...
AttributeError: Can only use .dt accessor with datetimelike values
``` | pandas.api.extensions.register_dataframe_accessor(name)[source]#
Register a custom accessor on DataFrame objects.
Parameters
namestrName under which the accessor should be registered. A warning is issued
if this name conflicts with a preexisting attribute.
Returns
callableA class decorator.
See also
registe... | reference/api/pandas.api.extensions.register_dataframe_accessor.html |
pandas.tseries.offsets.CustomBusinessMonthEnd.is_month_start | `pandas.tseries.offsets.CustomBusinessMonthEnd.is_month_start`
Return boolean whether a timestamp occurs on the month start.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_start(ts)
True
``` | CustomBusinessMonthEnd.is_month_start()#
Return boolean whether a timestamp occurs on the month start.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_start(ts)
True
| reference/api/pandas.tseries.offsets.CustomBusinessMonthEnd.is_month_start.html |
pandas.Timestamp.isoformat | `pandas.Timestamp.isoformat`
Return the time formatted according to ISO 8610.
```
>>> ts = pd.Timestamp('2020-03-14T15:32:52.192548651')
>>> ts.isoformat()
'2020-03-14T15:32:52.192548651'
>>> ts.isoformat(timespec='microseconds')
'2020-03-14T15:32:52.192548'
``` | Timestamp.isoformat()#
Return the time formatted according to ISO 8610.
The full format looks like ‘YYYY-MM-DD HH:MM:SS.mmmmmmnnn’.
By default, the fractional part is omitted if self.microsecond == 0
and self.nanosecond == 0.
If self.tzinfo is not None, the UTC offset is also attached, giving
giving a full format of ‘Y... | reference/api/pandas.Timestamp.isoformat.html |
pandas.errors.NumbaUtilError | `pandas.errors.NumbaUtilError`
Error raised for unsupported Numba engine routines. | exception pandas.errors.NumbaUtilError[source]#
Error raised for unsupported Numba engine routines.
| reference/api/pandas.errors.NumbaUtilError.html |
pandas.tseries.offsets.BYearBegin.is_month_start | `pandas.tseries.offsets.BYearBegin.is_month_start`
Return boolean whether a timestamp occurs on the month start.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_start(ts)
True
``` | BYearBegin.is_month_start()#
Return boolean whether a timestamp occurs on the month start.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_start(ts)
True
| reference/api/pandas.tseries.offsets.BYearBegin.is_month_start.html |
pandas.tseries.offsets.CustomBusinessHour.start | pandas.tseries.offsets.CustomBusinessHour.start | CustomBusinessHour.start#
| reference/api/pandas.tseries.offsets.CustomBusinessHour.start.html |
pandas.io.formats.style.Styler.highlight_max | `pandas.io.formats.style.Styler.highlight_max`
Highlight the maximum with a style. | Styler.highlight_max(subset=None, color='yellow', axis=0, props=None)[source]#
Highlight the maximum with a style.
Parameters
subsetlabel, array-like, IndexSlice, optionalA valid 2d input to DataFrame.loc[<subset>], or, in the case of a 1d input
or single key, to DataFrame.loc[:, <subset>] where the columns are
prior... | reference/api/pandas.io.formats.style.Styler.highlight_max.html |
pandas.read_stata | `pandas.read_stata`
Read Stata file into DataFrame.
```
>>> df = pd.read_stata('animals.dta')
``` | pandas.read_stata(filepath_or_buffer, *, convert_dates=True, convert_categoricals=True, index_col=None, convert_missing=False, preserve_dtypes=True, columns=None, order_categoricals=True, chunksize=None, iterator=False, compression='infer', storage_options=None)[source]#
Read Stata file into DataFrame.
Parameters
fil... | reference/api/pandas.read_stata.html |
pandas.Period.week | `pandas.Period.week`
Get the week of the year on the given Period.
```
>>> p = pd.Period("2018-03-11", "H")
>>> p.week
10
``` | Period.week#
Get the week of the year on the given Period.
Returns
int
See also
Period.dayofweekGet the day component of the Period.
Period.weekdayGet the day component of the Period.
Examples
>>> p = pd.Period("2018-03-11", "H")
>>> p.week
10
>>> p = pd.Period("2018-02-01", "D")
>>> p.week
5
>>> p = pd.... | reference/api/pandas.Period.week.html |
pandas.Series.str.istitle | `pandas.Series.str.istitle`
Check whether all characters in each string are titlecase.
```
>>> s1 = pd.Series(['one', 'one1', '1', ''])
``` | Series.str.istitle()[source]#
Check whether all characters in each string are titlecase.
This is equivalent to running the Python string method
str.istitle() for each element of the Series/Index. If a string
has zero characters, False is returned for that check.
Returns
Series or Index of boolSeries or Index of boole... | reference/api/pandas.Series.str.istitle.html |
pandas.core.resample.Resampler.apply | `pandas.core.resample.Resampler.apply`
Aggregate using one or more operations over the specified axis.
```
>>> s = pd.Series([1, 2, 3, 4, 5],
... index=pd.date_range('20130101', periods=5, freq='s'))
>>> s
2013-01-01 00:00:00 1
2013-01-01 00:00:01 2
2013-01-01 00:00:02 3
2013-01-01 00:00:03 4
... | Resampler.apply(func=None, *args, **kwargs)[source]#
Aggregate using one or more operations over the specified axis.
Parameters
funcfunction, str, list or dictFunction to use for aggregating the data. If a function, must either
work when passed a DataFrame or when passed to DataFrame.apply.
Accepted combinations are:... | reference/api/pandas.core.resample.Resampler.apply.html |
pandas.tseries.offsets.BYearBegin.nanos | pandas.tseries.offsets.BYearBegin.nanos | BYearBegin.nanos#
| reference/api/pandas.tseries.offsets.BYearBegin.nanos.html |
pandas.api.types.is_interval | pandas.api.types.is_interval | pandas.api.types.is_interval()#
| reference/api/pandas.api.types.is_interval.html |
pandas.Series.cat.as_unordered | `pandas.Series.cat.as_unordered`
Set the Categorical to be unordered. | Series.cat.as_unordered(*args, **kwargs)[source]#
Set the Categorical to be unordered.
Parameters
inplacebool, default FalseWhether or not to set the ordered attribute in-place or return
a copy of this categorical with ordered set to False.
Deprecated since version 1.5.0.
Returns
Categorical or NoneUnordered Ca... | reference/api/pandas.Series.cat.as_unordered.html |
GroupBy | GroupBy | GroupBy objects are returned by groupby calls: pandas.DataFrame.groupby(), pandas.Series.groupby(), etc.
Indexing, iteration#
GroupBy.__iter__()
Groupby iterator.
GroupBy.groups
Dict {group name -> group labels}.
GroupBy.indices
Dict {group name -> group indices}.
GroupBy.get_group(name[, obj])
Construct Data... | reference/groupby.html |
pandas.read_sql_query | `pandas.read_sql_query`
Read SQL query into a DataFrame. | pandas.read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize=None, dtype=None)[source]#
Read SQL query into a DataFrame.
Returns a DataFrame corresponding to the result set of the query
string. Optionally provide an index_col parameter to use one of the
columns as the inde... | reference/api/pandas.read_sql_query.html |
pandas.core.groupby.DataFrameGroupBy.cumprod | `pandas.core.groupby.DataFrameGroupBy.cumprod`
Cumulative product for each group. | DataFrameGroupBy.cumprod(axis=0, *args, **kwargs)[source]#
Cumulative product for each group.
Returns
Series or DataFrame
See also
Series.groupbyApply a function groupby to a Series.
DataFrame.groupbyApply a function groupby to each row or column of a DataFrame.
| reference/api/pandas.core.groupby.DataFrameGroupBy.cumprod.html |
How to create new columns derived from existing columns? | How to create new columns derived from existing columns?
For this tutorial, air quality data about \(NO_2\) is used, made
available by OpenAQ and using the
py-openaq package.
The air_quality_no2.csv data set provides \(NO_2\) values for
the measurement stations FR04014, BETR801 and London Westminster
in respectively Pa... | this tutorial:
Air quality data
For this tutorial, air quality data about \(NO_2\) is used, made
available by OpenAQ and using the
py-openaq package.
The air_quality_no2.csv data set provides \(NO_2\) values for
the measurement stations FR04014, BETR801 and London Westminster
in respectively Paris, Antw... | getting_started/intro_tutorials/05_add_columns.html |
Options and settings | API for configuring global behavior. See the User Guide for more.
Working with options#
describe_option(pat[, _print_desc])
Prints the description for one or more registered options.
reset_option(pat)
Reset one or more options to their default value.
get_option(pat)
Retrieves the value of the specified option.... | reference/options.html | null |
pandas.Series.str.slice_replace | `pandas.Series.str.slice_replace`
Replace a positional slice of a string with another value.
```
>>> s = pd.Series(['a', 'ab', 'abc', 'abdc', 'abcde'])
>>> s
0 a
1 ab
2 abc
3 abdc
4 abcde
dtype: object
``` | Series.str.slice_replace(start=None, stop=None, repl=None)[source]#
Replace a positional slice of a string with another value.
Parameters
startint, optionalLeft index position to use for the slice. If not specified (None),
the slice is unbounded on the left, i.e. slice from the start
of the string.
stopint, optional... | reference/api/pandas.Series.str.slice_replace.html |
pandas.DataFrame.isna | `pandas.DataFrame.isna`
Detect missing values.
```
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
... born=[pd.NaT, pd.Timestamp('1939-05-27'),
... pd.Timestamp('1940-04-25')],
... name=['Alfred', 'Batman', ''],
... toy=[None, 'Batmobile'... | DataFrame.isna()[source]#
Detect missing values.
Return a boolean same-sized object indicating if the values are NA.
NA values, such as None or numpy.NaN, gets mapped to True
values.
Everything else gets mapped to False values. Characters such as empty
strings '' or numpy.inf are not considered NA values
(unless you se... | reference/api/pandas.DataFrame.isna.html |
pandas.tseries.offsets.BusinessMonthBegin.n | pandas.tseries.offsets.BusinessMonthBegin.n | BusinessMonthBegin.n#
| reference/api/pandas.tseries.offsets.BusinessMonthBegin.n.html |
pandas.io.stata.StataReader.value_labels | `pandas.io.stata.StataReader.value_labels`
Return a nested dict associating each variable name to its value and label. | StataReader.value_labels()[source]#
Return a nested dict associating each variable name to its value and label.
Returns
dict
| reference/api/pandas.io.stata.StataReader.value_labels.html |
pandas.IntervalIndex.is_overlapping | `pandas.IntervalIndex.is_overlapping`
Return True if the IntervalIndex has overlapping intervals, else False.
Two intervals overlap if they share a common point, including closed
endpoints. Intervals that only have an open endpoint in common do not
overlap.
```
>>> index = pd.IntervalIndex.from_tuples([(0, 2), (1, 3), ... | property IntervalIndex.is_overlapping[source]#
Return True if the IntervalIndex has overlapping intervals, else False.
Two intervals overlap if they share a common point, including closed
endpoints. Intervals that only have an open endpoint in common do not
overlap.
Returns
boolBoolean indicating if the IntervalIndex... | reference/api/pandas.IntervalIndex.is_overlapping.html |
pandas.core.groupby.DataFrameGroupBy.skew | `pandas.core.groupby.DataFrameGroupBy.skew`
Return unbiased skew over requested axis. | property DataFrameGroupBy.skew[source]#
Return unbiased skew over requested axis.
Normalized by N-1.
Parameters
axis{index (0), columns (1)}Axis for the function to be applied on.
For Series this parameter is unused and defaults to 0.
skipnabool, default TrueExclude NA/null values when computing the result.
levelin... | reference/api/pandas.core.groupby.DataFrameGroupBy.skew.html |
pandas.tseries.offsets.Easter.onOffset | pandas.tseries.offsets.Easter.onOffset | Easter.onOffset()#
| reference/api/pandas.tseries.offsets.Easter.onOffset.html |
pandas.tseries.offsets.Tick.rollforward | `pandas.tseries.offsets.Tick.rollforward`
Roll provided date forward to next offset only if not on offset. | Tick.rollforward()#
Roll provided date forward to next offset only if not on offset.
Returns
TimeStampRolled timestamp if not on offset, otherwise unchanged timestamp.
| reference/api/pandas.tseries.offsets.Tick.rollforward.html |
pandas.Index.view | pandas.Index.view | Index.view(cls=None)[source]#
| reference/api/pandas.Index.view.html |
pandas.tseries.offsets.BYearBegin.onOffset | pandas.tseries.offsets.BYearBegin.onOffset | BYearBegin.onOffset()#
| reference/api/pandas.tseries.offsets.BYearBegin.onOffset.html |
pandas.to_timedelta | `pandas.to_timedelta`
Convert argument to timedelta.
Timedeltas are absolute differences in times, expressed in difference
units (e.g. days, hours, minutes, seconds). This method converts
an argument from a recognized timedelta format / value into
a Timedelta type.
```
>>> pd.to_timedelta('1 days 06:05:01.00003')
Timed... | pandas.to_timedelta(arg, unit=None, errors='raise')[source]#
Convert argument to timedelta.
Timedeltas are absolute differences in times, expressed in difference
units (e.g. days, hours, minutes, seconds). This method converts
an argument from a recognized timedelta format / value into
a Timedelta type.
Parameters
ar... | reference/api/pandas.to_timedelta.html |
pandas.DataFrame.plot.bar | `pandas.DataFrame.plot.bar`
Vertical bar plot.
```
>>> df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
>>> ax = df.plot.bar(x='lab', y='val', rot=0)
``` | DataFrame.plot.bar(x=None, y=None, **kwargs)[source]#
Vertical bar plot.
A bar plot is a plot that presents categorical data with
rectangular bars with lengths proportional to the values that they
represent. A bar plot shows comparisons among discrete categories. One
axis of the plot shows the specific categories being... | reference/api/pandas.DataFrame.plot.bar.html |
pandas.tseries.offsets.YearEnd.is_month_end | `pandas.tseries.offsets.YearEnd.is_month_end`
Return boolean whether a timestamp occurs on the month end.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_end(ts)
False
``` | YearEnd.is_month_end()#
Return boolean whether a timestamp occurs on the month end.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_month_end(ts)
False
| reference/api/pandas.tseries.offsets.YearEnd.is_month_end.html |
pandas.tseries.offsets.Nano.is_quarter_end | `pandas.tseries.offsets.Nano.is_quarter_end`
Return boolean whether a timestamp occurs on the quarter end.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_quarter_end(ts)
False
``` | Nano.is_quarter_end()#
Return boolean whether a timestamp occurs on the quarter end.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_quarter_end(ts)
False
| reference/api/pandas.tseries.offsets.Nano.is_quarter_end.html |
pandas.tseries.offsets.Hour.normalize | pandas.tseries.offsets.Hour.normalize | Hour.normalize#
| reference/api/pandas.tseries.offsets.Hour.normalize.html |
Testing | Assertion functions#
testing.assert_frame_equal(left, right[, ...])
Check that left and right DataFrame are equal.
testing.assert_series_equal(left, right[, ...])
Check that left and right Series are equal.
testing.assert_index_equal(left, right[, ...])
Check that left and right Index are equal.
testing.assert... | reference/testing.html | null |
pandas.Timestamp.month | pandas.Timestamp.month | Timestamp.month#
| reference/api/pandas.Timestamp.month.html |
pandas.tseries.offsets.Tick.normalize | pandas.tseries.offsets.Tick.normalize | Tick.normalize#
| reference/api/pandas.tseries.offsets.Tick.normalize.html |
pandas.tseries.offsets.QuarterBegin.freqstr | `pandas.tseries.offsets.QuarterBegin.freqstr`
Return a string representing the frequency.
Examples
```
>>> pd.DateOffset(5).freqstr
'<5 * DateOffsets>'
``` | QuarterBegin.freqstr#
Return a string representing the frequency.
Examples
>>> pd.DateOffset(5).freqstr
'<5 * DateOffsets>'
>>> pd.offsets.BusinessHour(2).freqstr
'2BH'
>>> pd.offsets.Nano().freqstr
'N'
>>> pd.offsets.Nano(-3).freqstr
'-3N'
| reference/api/pandas.tseries.offsets.QuarterBegin.freqstr.html |
DataFrame | DataFrame | Constructor#
DataFrame([data, index, columns, dtype, copy])
Two-dimensional, size-mutable, potentially heterogeneous tabular data.
Attributes and underlying data#
Axes
DataFrame.index
The index (row labels) of the DataFrame.
DataFrame.columns
The column labels of the DataFrame.
DataFrame.dtyp... | reference/frame.html |
pandas.core.resample.Resampler.pipe | `pandas.core.resample.Resampler.pipe`
Apply a func with arguments to this Resampler object and return its result.
```
>>> h(g(f(df.groupby('group')), arg1=a), arg2=b, arg3=c)
``` | Resampler.pipe(func, *args, **kwargs)[source]#
Apply a func with arguments to this Resampler object and return its result.
Use .pipe when you want to improve readability by chaining together
functions that expect Series, DataFrames, GroupBy or Resampler objects.
Instead of writing
>>> h(g(f(df.groupby('group')), arg1=a... | reference/api/pandas.core.resample.Resampler.pipe.html |
pandas.Series.fillna | `pandas.Series.fillna`
Fill NA/NaN values using the specified method.
Value to use to fill holes (e.g. 0), alternately a
dict/Series/DataFrame of values specifying which value to use for
each index (for a Series) or column (for a DataFrame). Values not
in the dict/Series/DataFrame will not be filled. This value cannot... | Series.fillna(value=None, *, method=None, axis=None, inplace=False, limit=None, downcast=None)[source]#
Fill NA/NaN values using the specified method.
Parameters
valuescalar, dict, Series, or DataFrameValue to use to fill holes (e.g. 0), alternately a
dict/Series/DataFrame of values specifying which value to use for
... | reference/api/pandas.Series.fillna.html |
pandas.api.types.is_complex_dtype | `pandas.api.types.is_complex_dtype`
Check whether the provided array or dtype is of a complex dtype.
```
>>> is_complex_dtype(str)
False
>>> is_complex_dtype(int)
False
>>> is_complex_dtype(np.complex_)
True
>>> is_complex_dtype(np.array(['a', 'b']))
False
>>> is_complex_dtype(pd.Series([1, 2]))
False
>>> is_complex_dt... | pandas.api.types.is_complex_dtype(arr_or_dtype)[source]#
Check whether the provided array or dtype is of a complex dtype.
Parameters
arr_or_dtypearray-like or dtypeThe array or dtype to check.
Returns
booleanWhether or not the array or dtype is of a complex dtype.
Examples
>>> is_complex_dtype(str)
False
>>> ... | reference/api/pandas.api.types.is_complex_dtype.html |
pandas.core.groupby.DataFrameGroupBy.cummax | `pandas.core.groupby.DataFrameGroupBy.cummax`
Cumulative max for each group. | DataFrameGroupBy.cummax(axis=0, numeric_only=False, **kwargs)[source]#
Cumulative max for each group.
Returns
Series or DataFrame
See also
Series.groupbyApply a function groupby to a Series.
DataFrame.groupbyApply a function groupby to each row or column of a DataFrame.
| reference/api/pandas.core.groupby.DataFrameGroupBy.cummax.html |
pandas.Series.between_time | `pandas.Series.between_time`
Select values between particular times of the day (e.g., 9:00-9:30 AM).
```
>>> i = pd.date_range('2018-04-09', periods=4, freq='1D20min')
>>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts
A
2018-04-09 00:00:00 1
2018-04-10 00:20:00 2
2018-04-11 00:40:00 3
2... | Series.between_time(start_time, end_time, include_start=_NoDefault.no_default, include_end=_NoDefault.no_default, inclusive=None, axis=None)[source]#
Select values between particular times of the day (e.g., 9:00-9:30 AM).
By setting start_time to be later than end_time,
you can get the times that are not between the tw... | reference/api/pandas.Series.between_time.html |
pandas.Interval.open_left | `pandas.Interval.open_left`
Check if the interval is open on the left side. | Interval.open_left#
Check if the interval is open on the left side.
For the meaning of closed and open see Interval.
Returns
boolTrue if the Interval is not closed on the left-side.
| reference/api/pandas.Interval.open_left.html |
pandas.describe_option | `pandas.describe_option`
Prints the description for one or more registered options. | pandas.describe_option(pat, _print_desc=False) = <pandas._config.config.CallableDynamicDoc object>#
Prints the description for one or more registered options.
Call with no arguments to get a listing for all registered options.
Available options:
compute.[use_bottleneck, use_numba, use_numexpr]
display.[chop_threshold,... | reference/api/pandas.describe_option.html |
pandas.Series.idxmin | `pandas.Series.idxmin`
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
```
>>> s = pd.Series(data=[1, None, 4, 1],
... index=['A', 'B', 'C', 'D'])
>>> s
A 1.0
B NaN
C 4.0
D 1.0
dtype: float64
``` | Series.idxmin(axis=0, skipna=True, *args, **kwargs)[source]#
Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that
value is returned.
Parameters
axis{0 or ‘index’}Unused. Parameter needed for compatibility with DataFrame.
skipnabool, default TrueExclude NA/nul... | reference/api/pandas.Series.idxmin.html |
pandas.DatetimeIndex.weekofyear | `pandas.DatetimeIndex.weekofyear`
The week ordinal of the year. | property DatetimeIndex.weekofyear[source]#
The week ordinal of the year.
Deprecated since version 1.1.0.
weekofyear and week have been deprecated.
Please use DatetimeIndex.isocalendar().week instead.
| reference/api/pandas.DatetimeIndex.weekofyear.html |
pandas.tseries.offsets.Hour.apply_index | `pandas.tseries.offsets.Hour.apply_index`
Vectorized apply of DateOffset to DatetimeIndex. | Hour.apply_index()#
Vectorized apply of DateOffset to DatetimeIndex.
Deprecated since version 1.1.0: Use offset + dtindex instead.
Parameters
indexDatetimeIndex
Returns
DatetimeIndex
Raises
NotImplementedErrorWhen the specific offset subclass does not have a vectorized
implementation.
| reference/api/pandas.tseries.offsets.Hour.apply_index.html |
pandas.core.window.rolling.Rolling.max | `pandas.core.window.rolling.Rolling.max`
Calculate the rolling maximum.
Include only float, int, boolean columns. | Rolling.max(numeric_only=False, *args, engine=None, engine_kwargs=None, **kwargs)[source]#
Calculate the rolling maximum.
Parameters
numeric_onlybool, default FalseInclude only float, int, boolean columns.
New in version 1.5.0.
*argsFor NumPy compatibility and will not have an effect on the result.
Deprecated sin... | reference/api/pandas.core.window.rolling.Rolling.max.html |
pandas.Index.set_value | `pandas.Index.set_value`
Fast lookup of value from 1-dimensional ndarray. | final Index.set_value(arr, key, value)[source]#
Fast lookup of value from 1-dimensional ndarray.
Deprecated since version 1.0.
Notes
Only use this if you know what you’re doing.
| reference/api/pandas.Index.set_value.html |
pandas.tseries.offsets.Easter.is_quarter_end | `pandas.tseries.offsets.Easter.is_quarter_end`
Return boolean whether a timestamp occurs on the quarter end.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_quarter_end(ts)
False
``` | Easter.is_quarter_end()#
Return boolean whether a timestamp occurs on the quarter end.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_quarter_end(ts)
False
| reference/api/pandas.tseries.offsets.Easter.is_quarter_end.html |
pandas.io.formats.style.Styler.set_table_styles | `pandas.io.formats.style.Styler.set_table_styles`
Set the table styles included within the <style> HTML element.
```
>>> df = pd.DataFrame(np.random.randn(10, 4),
... columns=['A', 'B', 'C', 'D'])
>>> df.style.set_table_styles(
... [{'selector': 'tr:hover',
... 'props': [('background-color',... | Styler.set_table_styles(table_styles=None, axis=0, overwrite=True, css_class_names=None)[source]#
Set the table styles included within the <style> HTML element.
This function can be used to style the entire table, columns, rows or
specific HTML selectors.
Parameters
table_styleslist or dictIf supplying a list, each i... | reference/api/pandas.io.formats.style.Styler.set_table_styles.html |
pandas.tseries.offsets.FY5253Quarter.get_weeks | pandas.tseries.offsets.FY5253Quarter.get_weeks | FY5253Quarter.get_weeks()#
| reference/api/pandas.tseries.offsets.FY5253Quarter.get_weeks.html |
pandas.core.groupby.DataFrameGroupBy.corrwith | `pandas.core.groupby.DataFrameGroupBy.corrwith`
Compute pairwise correlation.
```
>>> index = ["a", "b", "c", "d", "e"]
>>> columns = ["one", "two", "three", "four"]
>>> df1 = pd.DataFrame(np.arange(20).reshape(5, 4), index=index, columns=columns)
>>> df2 = pd.DataFrame(np.arange(16).reshape(4, 4), index=index[:4], col... | property DataFrameGroupBy.corrwith[source]#
Compute pairwise correlation.
Pairwise correlation is computed between rows or columns of
DataFrame with rows or columns of Series or DataFrame. DataFrames
are first aligned along both axes before computing the
correlations.
Parameters
otherDataFrame, SeriesObject with whic... | reference/api/pandas.core.groupby.DataFrameGroupBy.corrwith.html |
pandas.tseries.offsets.QuarterEnd.is_year_end | `pandas.tseries.offsets.QuarterEnd.is_year_end`
Return boolean whether a timestamp occurs on the year end.
Examples
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_year_end(ts)
False
``` | QuarterEnd.is_year_end()#
Return boolean whether a timestamp occurs on the year end.
Examples
>>> ts = pd.Timestamp(2022, 1, 1)
>>> freq = pd.offsets.Hour(5)
>>> freq.is_year_end(ts)
False
| reference/api/pandas.tseries.offsets.QuarterEnd.is_year_end.html |
pandas.Series.corr | `pandas.Series.corr`
Compute correlation with other Series, excluding missing values.
The two Series objects are not required to be the same length and will be
aligned internally before the correlation function is applied.
```
>>> def histogram_intersection(a, b):
... v = np.minimum(a, b).sum().round(decimals=1)
..... | Series.corr(other, method='pearson', min_periods=None)[source]#
Compute correlation with other Series, excluding missing values.
The two Series objects are not required to be the same length and will be
aligned internally before the correlation function is applied.
Parameters
otherSeriesSeries with which to compute t... | reference/api/pandas.Series.corr.html |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.