title stringlengths 5 65 | summary stringlengths 5 98.2k | context stringlengths 9 121k | path stringlengths 10 84 ⌀ |
|---|---|---|---|
pandas.DataFrame.rank | `pandas.DataFrame.rank`
Compute numerical data ranks (1 through n) along axis.
```
>>> df = pd.DataFrame(data={'Animal': ['cat', 'penguin', 'dog',
... 'spider', 'snake'],
... 'Number_legs': [4, 2, 4, 8, np.nan]})
>>> df
Animal Number_legs
0 cat ... | DataFrame.rank(axis=0, method='average', numeric_only=_NoDefault.no_default, na_option='keep', ascending=True, pct=False)[source]#
Compute numerical data ranks (1 through n) along axis.
By default, equal values are assigned a rank that is the average of the
ranks of those values.
Parameters
axis{0 or ‘index’, 1 or ‘c... | reference/api/pandas.DataFrame.rank.html |
pandas.tseries.offsets.Minute.normalize | pandas.tseries.offsets.Minute.normalize | Minute.normalize#
| reference/api/pandas.tseries.offsets.Minute.normalize.html |
pandas.tseries.offsets.CustomBusinessMonthBegin.normalize | pandas.tseries.offsets.CustomBusinessMonthBegin.normalize | CustomBusinessMonthBegin.normalize#
| reference/api/pandas.tseries.offsets.CustomBusinessMonthBegin.normalize.html |
pandas.io.formats.style.Styler.concat | `pandas.io.formats.style.Styler.concat`
Append another Styler to combine the output into a single table.
```
>>> df = DataFrame([[4, 6], [1, 9], [3, 4], [5, 5], [9,6]],
... columns=["Mike", "Jim"],
... index=["Mon", "Tue", "Wed", "Thurs", "Fri"])
>>> styler = df.style.concat(df.agg(["sum"]... | Styler.concat(other)[source]#
Append another Styler to combine the output into a single table.
New in version 1.5.0.
Parameters
otherStylerThe other Styler object which has already been styled and formatted. The
data for this Styler must have the same columns as the original, and the
number of index levels must als... | reference/api/pandas.io.formats.style.Styler.concat.html |
pandas.io.formats.style.Styler.to_string | `pandas.io.formats.style.Styler.to_string`
Write Styler to a file, buffer or string in text format. | Styler.to_string(buf=None, *, encoding=None, sparse_index=None, sparse_columns=None, max_rows=None, max_columns=None, delimiter=' ')[source]#
Write Styler to a file, buffer or string in text format.
New in version 1.5.0.
Parameters
bufstr, path object, file-like object, optionalString, path object (implementing os.... | reference/api/pandas.io.formats.style.Styler.to_string.html |
pandas.tseries.offsets.WeekOfMonth.is_year_start | `pandas.tseries.offsets.WeekOfMonth.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
``` | WeekOfMonth.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.WeekOfMonth.is_year_start.html |
pandas.api.extensions.ExtensionArray.take | `pandas.api.extensions.ExtensionArray.take`
Take elements from an array.
Indices to be taken. | ExtensionArray.take(indices, *, allow_fill=False, fill_value=None)[source]#
Take elements from an array.
Parameters
indicessequence of int or one-dimensional np.ndarray of intIndices to be taken.
allow_fillbool, default FalseHow to handle negative values in indices.
False: negative values in indices indicate positi... | reference/api/pandas.api.extensions.ExtensionArray.take.html |
pandas.tseries.offsets.SemiMonthBegin.is_year_end | `pandas.tseries.offsets.SemiMonthBegin.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
``` | SemiMonthBegin.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.SemiMonthBegin.is_year_end.html |
pandas.tseries.offsets.Milli.base | `pandas.tseries.offsets.Milli.base`
Returns a copy of the calling offset object with n=1 and all other
attributes equal. | Milli.base#
Returns a copy of the calling offset object with n=1 and all other
attributes equal.
| reference/api/pandas.tseries.offsets.Milli.base.html |
pandas.Timestamp.is_month_start | `pandas.Timestamp.is_month_start`
Return True if date is first day of month.
Examples
```
>>> ts = pd.Timestamp(2020, 3, 14)
>>> ts.is_month_start
False
``` | Timestamp.is_month_start#
Return True if date is first day of month.
Examples
>>> ts = pd.Timestamp(2020, 3, 14)
>>> ts.is_month_start
False
>>> ts = pd.Timestamp(2020, 1, 1)
>>> ts.is_month_start
True
| reference/api/pandas.Timestamp.is_month_start.html |
pandas.CategoricalIndex.reorder_categories | `pandas.CategoricalIndex.reorder_categories`
Reorder categories as specified in new_categories.
new_categories need to include all old categories and no new category
items. | CategoricalIndex.reorder_categories(*args, **kwargs)[source]#
Reorder categories as specified in new_categories.
new_categories need to include all old categories and no new category
items.
Parameters
new_categoriesIndex-likeThe categories in new order.
orderedbool, optionalWhether or not the categorical is treated ... | reference/api/pandas.CategoricalIndex.reorder_categories.html |
pandas.tseries.offsets.CustomBusinessMonthBegin.apply | pandas.tseries.offsets.CustomBusinessMonthBegin.apply | CustomBusinessMonthBegin.apply()#
| reference/api/pandas.tseries.offsets.CustomBusinessMonthBegin.apply.html |
pandas.Interval.mid | `pandas.Interval.mid`
Return the midpoint of the Interval. | Interval.mid#
Return the midpoint of the Interval.
| reference/api/pandas.Interval.mid.html |
pandas.io.formats.style.Styler.bar | `pandas.io.formats.style.Styler.bar`
Draw bar chart in the cell backgrounds. | Styler.bar(subset=None, axis=0, *, color=None, cmap=None, width=100, height=100, align='mid', vmin=None, vmax=None, props='width: 10em;')[source]#
Draw bar chart in the cell backgrounds.
Changed in version 1.4.0.
Parameters
subsetlabel, array-like, IndexSlice, optionalA valid 2d input to DataFrame.loc[<subset>], or... | reference/api/pandas.io.formats.style.Styler.bar.html |
pandas.core.groupby.DataFrameGroupBy.count | `pandas.core.groupby.DataFrameGroupBy.count`
Compute count of group, excluding missing values.
Count of values within each group. | DataFrameGroupBy.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.DataFrameGroupBy.count.html |
Input/output | Input/output | Pickling#
read_pickle(filepath_or_buffer[, ...])
Load pickled pandas object (or any object) from file.
DataFrame.to_pickle(path[, compression, ...])
Pickle (serialize) object to file.
Flat file#
read_table(filepath_or_buffer, *[, sep, ...])
Read general delimited file into DataFrame.
read_csv(filepat... | reference/io.html |
pandas.tseries.offsets.YearEnd.__call__ | `pandas.tseries.offsets.YearEnd.__call__`
Call self as a function. | YearEnd.__call__(*args, **kwargs)#
Call self as a function.
| reference/api/pandas.tseries.offsets.YearEnd.__call__.html |
pandas.tseries.offsets.Easter.rollforward | `pandas.tseries.offsets.Easter.rollforward`
Roll provided date forward to next offset only if not on offset. | Easter.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.Easter.rollforward.html |
pandas.TimedeltaIndex.days | `pandas.TimedeltaIndex.days`
Number of days for each element. | property TimedeltaIndex.days[source]#
Number of days for each element.
| reference/api/pandas.TimedeltaIndex.days.html |
pandas.tseries.offsets.Week.is_anchored | `pandas.tseries.offsets.Week.is_anchored`
Return boolean whether the frequency is a unit frequency (n=1).
```
>>> pd.DateOffset().is_anchored()
True
>>> pd.DateOffset(2).is_anchored()
False
``` | Week.is_anchored()#
Return boolean whether the frequency is a unit frequency (n=1).
Examples
>>> pd.DateOffset().is_anchored()
True
>>> pd.DateOffset(2).is_anchored()
False
| reference/api/pandas.tseries.offsets.Week.is_anchored.html |
pandas arrays, scalars, and data types | pandas arrays, scalars, and data types
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 | 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.YearEnd.copy | `pandas.tseries.offsets.YearEnd.copy`
Return a copy of the frequency.
Examples
```
>>> freq = pd.DateOffset(1)
>>> freq_copy = freq.copy()
>>> freq is freq_copy
False
``` | YearEnd.copy()#
Return a copy of the frequency.
Examples
>>> freq = pd.DateOffset(1)
>>> freq_copy = freq.copy()
>>> freq is freq_copy
False
| reference/api/pandas.tseries.offsets.YearEnd.copy.html |
pandas.PeriodIndex.start_time | `pandas.PeriodIndex.start_time`
Get the Timestamp for the start of the period.
```
>>> period = pd.Period('2012-1-1', freq='D')
>>> period
Period('2012-01-01', 'D')
``` | property PeriodIndex.start_time[source]#
Get the Timestamp for the start of the period.
Returns
Timestamp
See also
Period.end_timeReturn the end Timestamp.
Period.dayofyearReturn the day of year.
Period.daysinmonthReturn the days in that month.
Period.dayofweekReturn the day of the week.
Examples
>>> perio... | reference/api/pandas.PeriodIndex.start_time.html |
pandas.Index.shape | `pandas.Index.shape`
Return a tuple of the shape of the underlying data. | property Index.shape[source]#
Return a tuple of the shape of the underlying data.
| reference/api/pandas.Index.shape.html |
pandas.Timestamp.to_julian_date | `pandas.Timestamp.to_julian_date`
Convert TimeStamp to a Julian Date.
```
>>> ts = pd.Timestamp('2020-03-14T15:32:52')
>>> ts.to_julian_date()
2458923.147824074
``` | Timestamp.to_julian_date()#
Convert TimeStamp to a Julian Date.
0 Julian date is noon January 1, 4713 BC.
Examples
>>> ts = pd.Timestamp('2020-03-14T15:32:52')
>>> ts.to_julian_date()
2458923.147824074
| reference/api/pandas.Timestamp.to_julian_date.html |
pandas.Series.cumsum | `pandas.Series.cumsum`
Return cumulative sum over a DataFrame or Series axis.
Returns a DataFrame or Series of the same size containing the cumulative
sum.
```
>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0 2.0
1 NaN
2 5.0
3 -1.0
4 0.0
dtype: float64
``` | Series.cumsum(axis=None, skipna=True, *args, **kwargs)[source]#
Return cumulative sum over a DataFrame or Series axis.
Returns a DataFrame or Series of the same size containing the cumulative
sum.
Parameters
axis{0 or ‘index’, 1 or ‘columns’}, default 0The index or the name of the axis. 0 is equivalent to None or ‘in... | reference/api/pandas.Series.cumsum.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.Series.mul | `pandas.Series.mul`
Return Multiplication of series and other, element-wise (binary operator mul).
```
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a 1.0
b 1.0
c 1.0
d NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a 1.0
b NaN
d... | Series.mul(other, level=None, fill_value=None, axis=0)[source]#
Return Multiplication of series and other, element-wise (binary operator mul).
Equivalent to series * other, but with support to substitute a fill_value for
missing data in either one of the inputs.
Parameters
otherSeries or scalar value
levelint or name... | reference/api/pandas.Series.mul.html |
pandas.tseries.offsets.FY5253Quarter.is_quarter_start | `pandas.tseries.offsets.FY5253Quarter.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
``` | FY5253Quarter.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.FY5253Quarter.is_quarter_start.html |
pandas.Series.str.title | `pandas.Series.str.title`
Convert strings in the Series/Index to titlecase.
Equivalent to str.title().
```
>>> s = pd.Series(['lower', 'CAPITALS', 'this is a sentence', 'SwApCaSe'])
>>> s
0 lower
1 CAPITALS
2 this is a sentence
3 SwApCaSe
dtype: object
``` | Series.str.title()[source]#
Convert strings in the Series/Index to titlecase.
Equivalent to str.title().
Returns
Series or Index of object
See also
Series.str.lowerConverts all characters to lowercase.
Series.str.upperConverts all characters to uppercase.
Series.str.titleConverts first character of each word t... | reference/api/pandas.Series.str.title.html |
pandas.tseries.offsets.FY5253Quarter.nanos | pandas.tseries.offsets.FY5253Quarter.nanos | FY5253Quarter.nanos#
| reference/api/pandas.tseries.offsets.FY5253Quarter.nanos.html |
pandas.tseries.offsets.LastWeekOfMonth.name | `pandas.tseries.offsets.LastWeekOfMonth.name`
Return a string representing the base frequency.
```
>>> pd.offsets.Hour().name
'H'
``` | LastWeekOfMonth.name#
Return a string representing the base frequency.
Examples
>>> pd.offsets.Hour().name
'H'
>>> pd.offsets.Hour(5).name
'H'
| reference/api/pandas.tseries.offsets.LastWeekOfMonth.name.html |
pandas.tseries.offsets.BQuarterBegin.nanos | pandas.tseries.offsets.BQuarterBegin.nanos | BQuarterBegin.nanos#
| reference/api/pandas.tseries.offsets.BQuarterBegin.nanos.html |
pandas.DataFrame.first_valid_index | `pandas.DataFrame.first_valid_index`
Return index for first non-NA value or None, if no non-NA value is found.
Notes | DataFrame.first_valid_index()[source]#
Return index for first non-NA value or None, if no non-NA value is found.
Returns
scalartype of index
Notes
If all elements are non-NA/null, returns None.
Also returns None for empty Series/DataFrame.
| reference/api/pandas.DataFrame.first_valid_index.html |
pandas.io.formats.style.Styler.set_na_rep | `pandas.io.formats.style.Styler.set_na_rep`
Set the missing data representation on a Styler. | Styler.set_na_rep(na_rep)[source]#
Set the missing data representation on a Styler.
New in version 1.0.0.
Deprecated since version 1.3.0.
Parameters
na_repstr
Returns
selfStyler
Notes
This method is deprecated. See Styler.format()
| reference/api/pandas.io.formats.style.Styler.set_na_rep.html |
pandas.DataFrame.to_clipboard | `pandas.DataFrame.to_clipboard`
Copy object to the system clipboard.
```
>>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C'])
``` | DataFrame.to_clipboard(excel=True, sep=None, **kwargs)[source]#
Copy object to the system clipboard.
Write a text representation of object to the system clipboard.
This can be pasted into Excel, for example.
Parameters
excelbool, default TrueProduce output in a csv format for easy pasting into excel.
True, use the p... | reference/api/pandas.DataFrame.to_clipboard.html |
pandas.tseries.offsets.WeekOfMonth | `pandas.tseries.offsets.WeekOfMonth`
Describes monthly dates like “the Tuesday of the 2nd week of each month”.
A specific integer for the week of the month.
e.g. 0 is 1st week of month, 1 is the 2nd week, etc.
```
>>> ts = pd.Timestamp(2022, 1, 1)
>>> ts + pd.offsets.WeekOfMonth()
Timestamp('2022-01-03 00:00:00')
``` | class pandas.tseries.offsets.WeekOfMonth#
Describes monthly dates like “the Tuesday of the 2nd week of each month”.
Parameters
nint
weekint {0, 1, 2, 3, …}, default 0A specific integer for the week of the month.
e.g. 0 is 1st week of month, 1 is the 2nd week, etc.
weekdayint {0, 1, …, 6}, default 0A specific integer... | reference/api/pandas.tseries.offsets.WeekOfMonth.html |
pandas.Index.is_monotonic_decreasing | `pandas.Index.is_monotonic_decreasing`
Return a boolean if the values are equal or decreasing.
```
>>> Index([3, 2, 1]).is_monotonic_decreasing
True
>>> Index([3, 2, 2]).is_monotonic_decreasing
True
>>> Index([3, 1, 2]).is_monotonic_decreasing
False
``` | property Index.is_monotonic_decreasing[source]#
Return a boolean if the values are equal or decreasing.
Examples
>>> Index([3, 2, 1]).is_monotonic_decreasing
True
>>> Index([3, 2, 2]).is_monotonic_decreasing
True
>>> Index([3, 1, 2]).is_monotonic_decreasing
False
| reference/api/pandas.Index.is_monotonic_decreasing.html |
pandas.errors.PerformanceWarning | `pandas.errors.PerformanceWarning`
Warning raised when there is a possible performance impact. | exception pandas.errors.PerformanceWarning[source]#
Warning raised when there is a possible performance impact.
| reference/api/pandas.errors.PerformanceWarning.html |
pandas.Index.unique | `pandas.Index.unique`
Return unique values in the index. | Index.unique(level=None)[source]#
Return unique values in the index.
Unique values are returned in order of appearance, this does NOT sort.
Parameters
levelint or hashable, optionalOnly return values from specified level (for MultiIndex).
If int, gets the level by integer position, else by level name.
Returns
Ind... | reference/api/pandas.Index.unique.html |
Comparison with Stata | Comparison with Stata
For potential users coming from Stata
this page is meant to demonstrate how different Stata operations would be
performed in pandas.
If you’re new to pandas, you might want to first read through 10 Minutes to pandas
to familiarize yourself with the library.
As is customary, we import pandas and Nu... | For potential users coming from Stata
this page is meant to demonstrate how different Stata operations would be
performed in pandas.
If you’re new to pandas, you might want to first read through 10 Minutes to pandas
to familiarize yourself with the library.
As is customary, we import pandas and NumPy as follows:
In [1]... | getting_started/comparison/comparison_with_stata.html |
pandas.melt | `pandas.melt`
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
This function is useful to massage a DataFrame into a format where one
or more columns are identifier variables (id_vars), while all other
columns, considered measured variables (value_vars), are “unpivoted” to
the row axis,... | pandas.melt(frame, id_vars=None, value_vars=None, var_name=None, value_name='value', col_level=None, ignore_index=True)[source]#
Unpivot a DataFrame from wide to long format, optionally leaving identifiers set.
This function is useful to massage a DataFrame into a format where one
or more columns are identifier variabl... | reference/api/pandas.melt.html |
pandas.Index.is_ | `pandas.Index.is_`
More flexible, faster check like is but that works through views. | final Index.is_(other)[source]#
More flexible, faster check like is but that works through views.
Note: this is not the same as Index.identical(), which checks
that metadata is also the same.
Parameters
otherobjectOther object to compare against.
Returns
boolTrue if both have same underlying data, False otherwise... | reference/api/pandas.Index.is_.html |
pandas.tseries.offsets.CustomBusinessMonthBegin.calendar | pandas.tseries.offsets.CustomBusinessMonthBegin.calendar | CustomBusinessMonthBegin.calendar#
| reference/api/pandas.tseries.offsets.CustomBusinessMonthBegin.calendar.html |
pandas.tseries.offsets.Easter.__call__ | `pandas.tseries.offsets.Easter.__call__`
Call self as a function. | Easter.__call__(*args, **kwargs)#
Call self as a function.
| reference/api/pandas.tseries.offsets.Easter.__call__.html |
pandas.Series.dt.freq | pandas.Series.dt.freq | Series.dt.freq[source]#
| reference/api/pandas.Series.dt.freq.html |
pandas.core.window.rolling.Rolling.var | `pandas.core.window.rolling.Rolling.var`
Calculate the rolling variance.
```
>>> s = pd.Series([5, 5, 6, 7, 5, 5, 5])
>>> s.rolling(3).var()
0 NaN
1 NaN
2 0.333333
3 1.000000
4 1.000000
5 1.333333
6 0.000000
dtype: float64
``` | Rolling.var(ddof=1, numeric_only=False, *args, engine=None, engine_kwargs=None, **kwargs)[source]#
Calculate the rolling variance.
Parameters
ddofint, default 1Delta Degrees of Freedom. The divisor used in calculations
is N - ddof, where N represents the number of elements.
numeric_onlybool, default FalseInclude on... | reference/api/pandas.core.window.rolling.Rolling.var.html |
pandas.tseries.offsets.QuarterEnd.n | pandas.tseries.offsets.QuarterEnd.n | QuarterEnd.n#
| reference/api/pandas.tseries.offsets.QuarterEnd.n.html |
pandas.tseries.offsets.BusinessMonthEnd.is_quarter_start | `pandas.tseries.offsets.BusinessMonthEnd.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
``` | BusinessMonthEnd.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.BusinessMonthEnd.is_quarter_start.html |
pandas.tseries.offsets.Day.rule_code | pandas.tseries.offsets.Day.rule_code | Day.rule_code#
| reference/api/pandas.tseries.offsets.Day.rule_code.html |
pandas.tseries.offsets.CustomBusinessHour.rollforward | `pandas.tseries.offsets.CustomBusinessHour.rollforward`
Roll provided date forward to next offset only if not on offset. | CustomBusinessHour.rollforward(other)#
Roll provided date forward to next offset only if not on offset.
| reference/api/pandas.tseries.offsets.CustomBusinessHour.rollforward.html |
pandas.Timestamp.fromordinal | `pandas.Timestamp.fromordinal`
Construct a timestamp from a a proleptic Gregorian ordinal.
Date corresponding to a proleptic Gregorian ordinal.
```
>>> pd.Timestamp.fromordinal(737425)
Timestamp('2020-01-01 00:00:00')
``` | classmethod Timestamp.fromordinal(ordinal, freq=None, tz=None)#
Construct a timestamp from a a proleptic Gregorian ordinal.
Parameters
ordinalintDate corresponding to a proleptic Gregorian ordinal.
freqstr, DateOffsetOffset to apply to the Timestamp.
tzstr, pytz.timezone, dateutil.tz.tzfile or NoneTime zone for the... | reference/api/pandas.Timestamp.fromordinal.html |
pandas.tseries.offsets.SemiMonthBegin.is_month_end | `pandas.tseries.offsets.SemiMonthBegin.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
``` | SemiMonthBegin.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.SemiMonthBegin.is_month_end.html |
pandas.DataFrame.sparse.to_dense | `pandas.DataFrame.sparse.to_dense`
Convert a DataFrame with sparse values to dense.
```
>>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0])})
>>> df.sparse.to_dense()
A
0 0
1 1
2 0
``` | DataFrame.sparse.to_dense()[source]#
Convert a DataFrame with sparse values to dense.
New in version 0.25.0.
Returns
DataFrameA DataFrame with the same values stored as dense arrays.
Examples
>>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0])})
>>> df.sparse.to_dense()
A
0 0
1 1
2 0
| reference/api/pandas.DataFrame.sparse.to_dense.html |
pandas.ExcelWriter.if_sheet_exists | `pandas.ExcelWriter.if_sheet_exists`
How to behave when writing to a sheet that already exists in append mode. | property ExcelWriter.if_sheet_exists[source]#
How to behave when writing to a sheet that already exists in append mode.
| reference/api/pandas.ExcelWriter.if_sheet_exists.html |
pandas.tseries.offsets.SemiMonthEnd.rule_code | pandas.tseries.offsets.SemiMonthEnd.rule_code | SemiMonthEnd.rule_code#
| reference/api/pandas.tseries.offsets.SemiMonthEnd.rule_code.html |
pandas maintenance | pandas maintenance
This guide is for pandas’ maintainers. It may also be interesting to contributors
looking to understand the pandas development process and what steps are necessary
to become a maintainer.
The main contributing guide is available at Contributing to pandas.
pandas uses two levels of permissions: triage... | This guide is for pandas’ maintainers. It may also be interesting to contributors
looking to understand the pandas development process and what steps are necessary
to become a maintainer.
The main contributing guide is available at Contributing to pandas.
Roles#
pandas uses two levels of permissions: triage and core t... | development/maintaining.html |
Extending pandas | Extending pandas
While pandas provides a rich set of methods, containers, and data types, your
needs may not be fully satisfied. pandas offers a few options for extending
pandas.
Libraries can use the decorators
pandas.api.extensions.register_dataframe_accessor(),
pandas.api.extensions.register_series_accessor(), and
p... | While pandas provides a rich set of methods, containers, and data types, your
needs may not be fully satisfied. pandas offers a few options for extending
pandas.
Registering custom accessors#
Libraries can use the decorators
pandas.api.extensions.register_dataframe_accessor(),
pandas.api.extensions.register_series_acc... | development/extending.html |
pandas.tseries.offsets.BYearEnd.apply | pandas.tseries.offsets.BYearEnd.apply | BYearEnd.apply()#
| reference/api/pandas.tseries.offsets.BYearEnd.apply.html |
pandas.Series.dt.timetz | `pandas.Series.dt.timetz`
Returns numpy array of datetime.time objects with timezones. | Series.dt.timetz[source]#
Returns numpy array of datetime.time objects with timezones.
The time part of the Timestamps.
| reference/api/pandas.Series.dt.timetz.html |
pandas.tseries.offsets.Hour.n | pandas.tseries.offsets.Hour.n | Hour.n#
| reference/api/pandas.tseries.offsets.Hour.n.html |
pandas.Series.iloc | `pandas.Series.iloc`
Purely integer-location based indexing for selection by position.
.iloc[] is primarily integer position based (from 0 to
length-1 of the axis), but may also be used with a boolean
array.
```
>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
... {'a': 100, 'b': 200, 'c': 300, 'd': 400},
... ... | property Series.iloc[source]#
Purely integer-location based indexing for selection by position.
.iloc[] is primarily integer position based (from 0 to
length-1 of the axis), but may also be used with a boolean
array.
Allowed inputs are:
An integer, e.g. 5.
A list or array of integers, e.g. [4, 3, 0].
A slice object wi... | reference/api/pandas.Series.iloc.html |
pandas.tseries.offsets.FY5253Quarter.is_year_end | `pandas.tseries.offsets.FY5253Quarter.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
``` | FY5253Quarter.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.FY5253Quarter.is_year_end.html |
pandas.tseries.offsets.CustomBusinessDay.is_year_end | `pandas.tseries.offsets.CustomBusinessDay.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
``` | CustomBusinessDay.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.CustomBusinessDay.is_year_end.html |
pandas.Timedelta.to_numpy | `pandas.Timedelta.to_numpy`
Convert the Timedelta to a NumPy timedelta64. | Timedelta.to_numpy()#
Convert the Timedelta to a NumPy timedelta64.
New in version 0.25.0.
This is an alias method for Timedelta.to_timedelta64(). The dtype and
copy parameters are available here only for compatibility. Their values
will not affect the return value.
Returns
numpy.timedelta64
See also
Series.to... | reference/api/pandas.Timedelta.to_numpy.html |
pandas.core.window.expanding.Expanding.min | `pandas.core.window.expanding.Expanding.min`
Calculate the expanding minimum.
Include only float, int, boolean columns. | Expanding.min(numeric_only=False, *args, engine=None, engine_kwargs=None, **kwargs)[source]#
Calculate the expanding minimum.
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... | reference/api/pandas.core.window.expanding.Expanding.min.html |
pandas.DataFrame.last | `pandas.DataFrame.last`
Select final periods of time series data based on a date offset.
```
>>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
>>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts
A
2018-04-09 1
2018-04-11 2
2018-04-13 3
2018-04-15 4
``` | DataFrame.last(offset)[source]#
Select final periods of time series data based on a date offset.
For a DataFrame with a sorted DatetimeIndex, this function
selects the last few rows based on a date offset.
Parameters
offsetstr, DateOffset, dateutil.relativedeltaThe offset length of the data that will be selected. For... | reference/api/pandas.DataFrame.last.html |
pandas.DataFrame.boxplot | `pandas.DataFrame.boxplot`
Make a box plot from DataFrame columns.
```
>>> np.random.seed(1234)
>>> df = pd.DataFrame(np.random.randn(10, 4),
... columns=['Col1', 'Col2', 'Col3', 'Col4'])
>>> boxplot = df.boxplot(column=['Col1', 'Col2', 'Col3'])
``` | DataFrame.boxplot(column=None, by=None, ax=None, fontsize=None, rot=0, grid=True, figsize=None, layout=None, return_type=None, backend=None, **kwargs)[source]#
Make a box plot from DataFrame columns.
Make a box-and-whisker plot from DataFrame columns, optionally grouped
by some other columns. A box plot is a method for... | reference/api/pandas.DataFrame.boxplot.html |
pandas.Series.unique | `pandas.Series.unique`
Return unique values of Series object.
Uniques are returned in order of appearance. Hash table-based unique,
therefore does NOT sort.
```
>>> pd.Series([2, 1, 3, 3], name='A').unique()
array([2, 1, 3])
``` | Series.unique()[source]#
Return unique values of Series object.
Uniques are returned in order of appearance. Hash table-based unique,
therefore does NOT sort.
Returns
ndarray or ExtensionArrayThe unique values returned as a NumPy array. See Notes.
See also
Series.drop_duplicatesReturn Series with duplicate valu... | reference/api/pandas.Series.unique.html |
pandas.Series.ndim | `pandas.Series.ndim`
Number of dimensions of the underlying data, by definition 1. | property Series.ndim[source]#
Number of dimensions of the underlying data, by definition 1.
| reference/api/pandas.Series.ndim.html |
pandas.tseries.offsets.CustomBusinessDay.name | `pandas.tseries.offsets.CustomBusinessDay.name`
Return a string representing the base frequency.
```
>>> pd.offsets.Hour().name
'H'
``` | CustomBusinessDay.name#
Return a string representing the base frequency.
Examples
>>> pd.offsets.Hour().name
'H'
>>> pd.offsets.Hour(5).name
'H'
| reference/api/pandas.tseries.offsets.CustomBusinessDay.name.html |
pandas.tseries.offsets.WeekOfMonth.is_month_start | `pandas.tseries.offsets.WeekOfMonth.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
``` | WeekOfMonth.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.WeekOfMonth.is_month_start.html |
pandas.Period.freq | pandas.Period.freq | Period.freq#
| reference/api/pandas.Period.freq.html |
pandas.tseries.offsets.SemiMonthBegin.apply_index | `pandas.tseries.offsets.SemiMonthBegin.apply_index`
Vectorized apply of DateOffset to DatetimeIndex. | SemiMonthBegin.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.SemiMonthBegin.apply_index.html |
pandas.api.types.is_dict_like | `pandas.api.types.is_dict_like`
Check if the object is dict-like.
Whether obj has dict-like properties.
```
>>> is_dict_like({1: 2})
True
>>> is_dict_like([1, 2, 3])
False
>>> is_dict_like(dict)
False
>>> is_dict_like(dict())
True
``` | pandas.api.types.is_dict_like(obj)[source]#
Check if the object is dict-like.
Parameters
objThe object to check
Returns
is_dict_likeboolWhether obj has dict-like properties.
Examples
>>> is_dict_like({1: 2})
True
>>> is_dict_like([1, 2, 3])
False
>>> is_dict_like(dict)
False
>>> is_dict_like(dict())
True
| reference/api/pandas.api.types.is_dict_like.html |
pandas.Series.idxmin | `pandas.Series.idxmin`
Return the row label of the minimum value.
```
>>> 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.api.extensions.ExtensionArray.view | `pandas.api.extensions.ExtensionArray.view`
Return a view on the array. | ExtensionArray.view(dtype=None)[source]#
Return a view on the array.
Parameters
dtypestr, np.dtype, or ExtensionDtype, optionalDefault None.
Returns
ExtensionArray or np.ndarrayA view on the ExtensionArray’s data.
| reference/api/pandas.api.extensions.ExtensionArray.view.html |
pandas.MultiIndex.get_level_values | `pandas.MultiIndex.get_level_values`
Return vector of label values for requested level.
```
>>> mi = pd.MultiIndex.from_arrays((list('abc'), list('def')))
>>> mi.names = ['level_1', 'level_2']
``` | MultiIndex.get_level_values(level)[source]#
Return vector of label values for requested level.
Length of returned vector is equal to the length of the index.
Parameters
levelint or strlevel is either the integer position of the level in the
MultiIndex, or the name of the level.
Returns
valuesIndexValues is a leve... | reference/api/pandas.MultiIndex.get_level_values.html |
pandas.tseries.offsets.SemiMonthBegin.isAnchored | pandas.tseries.offsets.SemiMonthBegin.isAnchored | SemiMonthBegin.isAnchored()#
| reference/api/pandas.tseries.offsets.SemiMonthBegin.isAnchored.html |
pandas ecosystem | Increasingly, packages are being built on top of pandas to address specific needs
in data preparation, analysis and visualization.
This is encouraging because it means pandas is not only helping users to handle
their data tasks but also that it provides a better starting point for developers to
build powerful and more ... | ecosystem.html | null |
pandas.tseries.offsets.CustomBusinessDay.is_month_start | `pandas.tseries.offsets.CustomBusinessDay.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
``` | CustomBusinessDay.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.CustomBusinessDay.is_month_start.html |
pandas.api.types.is_datetime64_dtype | `pandas.api.types.is_datetime64_dtype`
Check whether an array-like or dtype is of the datetime64 dtype.
```
>>> is_datetime64_dtype(object)
False
>>> is_datetime64_dtype(np.datetime64)
True
>>> is_datetime64_dtype(np.array([], dtype=int))
False
>>> is_datetime64_dtype(np.array([], dtype=np.datetime64))
True
>>> is_date... | pandas.api.types.is_datetime64_dtype(arr_or_dtype)[source]#
Check whether an array-like or dtype is of the datetime64 dtype.
Parameters
arr_or_dtypearray-like or dtypeThe array-like or dtype to check.
Returns
booleanWhether or not the array-like or dtype is of the datetime64 dtype.
Examples
>>> is_datetime64_... | reference/api/pandas.api.types.is_datetime64_dtype.html |
pandas.DataFrame.drop | `pandas.DataFrame.drop`
Drop specified labels from rows or columns.
```
>>> df = pd.DataFrame(np.arange(12).reshape(3, 4),
... columns=['A', 'B', 'C', 'D'])
>>> df
A B C D
0 0 1 2 3
1 4 5 6 7
2 8 9 10 11
``` | DataFrame.drop(labels=None, *, axis=0, index=None, columns=None, level=None, inplace=False, errors='raise')[source]#
Drop specified labels from rows or columns.
Remove rows or columns by specifying label names and corresponding
axis, or by specifying directly index or column names. When using a
multi-index, labels on d... | reference/api/pandas.DataFrame.drop.html |
pandas.tseries.offsets.Minute.copy | `pandas.tseries.offsets.Minute.copy`
Return a copy of the frequency.
```
>>> freq = pd.DateOffset(1)
>>> freq_copy = freq.copy()
>>> freq is freq_copy
False
``` | Minute.copy()#
Return a copy of the frequency.
Examples
>>> freq = pd.DateOffset(1)
>>> freq_copy = freq.copy()
>>> freq is freq_copy
False
| reference/api/pandas.tseries.offsets.Minute.copy.html |
pandas.DataFrame.sort_index | `pandas.DataFrame.sort_index`
Sort object by labels (along an axis).
```
>>> df = pd.DataFrame([1, 2, 3, 4, 5], index=[100, 29, 234, 1, 150],
... columns=['A'])
>>> df.sort_index()
A
1 4
29 2
100 1
150 5
234 3
``` | DataFrame.sort_index(*, axis=0, level=None, ascending=True, inplace=False, kind='quicksort', na_position='last', sort_remaining=True, ignore_index=False, key=None)[source]#
Sort object by labels (along an axis).
Returns a new DataFrame sorted by label if inplace argument is
False, otherwise updates the original DataFra... | reference/api/pandas.DataFrame.sort_index.html |
End of preview. Expand in Data Studio
- Downloads last month
- 10