Compute the dot product between the Series and the columns of other.
This method computes the dot product between the Series and another one, or the Series and each columns of a DataFrame, or the Series and each columns of an array.
It can also be called using self @ other in Python >= 3.5.
The other object to compute the dot product with its columns.
Return the dot product of the Series and other if other is a Series, the Series of the dot product of Series and each rows of other if other is a DataFrame or a numpy.ndarray between the Series and each columns of the numpy array.
See also
Compute the matrix product with the DataFrame.
Multiplication of series and other, element-wise.
Notes
The Series and other has to share the same index if other is a Series or a DataFrame.
Examples


Return Series with specified index labels removed.
Remove elements of a Series based on specifying the index labels. When using a multi-index, labels on different levels can be removed by specifying the level.
Index labels to drop.
Redundant for application on Series.
Redundant for application on Series, but ‘index’ can be used instead of ‘labels’.
No change is made to the Series; use ‘index’ or ‘labels’ instead.
For MultiIndex, level for which the labels will be removed.
If True, do operation inplace and return None.
If ‘ignore’, suppress error and only existing labels are dropped.
Series with specified index labels removed or None if inplace=True.
If none of the labels are found in the index.
See also
Return only specified index labels of Series.
Return series without null values.
Return Series with duplicate values removed.
Drop specified labels from rows or columns.
Examples
Drop labels B en C
Drop 2nd level label in MultiIndex Series


Return Series with duplicate values removed.
Method to handle dropping duplicates:
‘first’ : Drop duplicates except for the first occurrence.
‘last’ : Drop duplicates except for the last occurrence.
False : Drop all duplicates.
If True, performs operation inplace and returns None.
Series with duplicates dropped or None if inplace=True.
See also
Equivalent method on Index.
Equivalent method on DataFrame.
Related method on Series, indicating duplicate Series values.
Examples
Generate a Series with duplicated entries.
With the ‘keep’ parameter, the selection behaviour of duplicated values can be changed. The value ‘first’ keeps the first occurrence for each set of duplicated entries. The default value of keep is ‘first’.
The value ‘last’ for parameter ‘keep’ keeps the last occurrence for each set of duplicated entries.
The value False for parameter ‘keep’ discards all sets of duplicated entries. Setting the value of ‘inplace’ to True performs the operation inplace and returns None.


Return Series/DataFrame with requested index / column level(s) removed.
If a string is given, must be the name of a level If list-like, elements must be names or positional indexes of levels.
Axis along which the level(s) is removed:
0 or ‘index’: remove level(s) in column.
1 or ‘columns’: remove level(s) in row.
Series/DataFrame with requested index / column level(s) removed.
Examples


Return a new Series with missing values removed.
See the User Guide for more on which values are considered missing, and how to work with missing data.
There is only one axis to drop values from.
If True, do operation inplace and return None.
Not in use. Kept for compatibility.
Series with NA entries dropped from it or None if inplace=True.
See also
Indicate missing values.
Indicate existing (non-missing) values.
Replace missing values.
Drop rows or columns which contain NA values.
Drop missing indices.
Examples
Drop NA values from a Series.
Keep the Series with valid entries in the same variable.
Empty strings are not considered NA values. None is considered an NA value.


Accessor object for datetimelike properties of the Series values.
Examples
Returns a Series indexed like the original Series. Raises TypeError if the Series does not contain datetimelike values.


Perform ceil operation on the data to the specified freq.
The frequency level to ceil the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.
Only relevant for DatetimeIndex:
‘infer’ will attempt to infer fall dst-transition hours based on order
bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times)
‘NaT’ will return NaT where there are ambiguous times
‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.
A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.
‘shift_forward’ will shift the nonexistent time forward to the closest existing time
‘shift_backward’ will shift the nonexistent time backward to the closest existing time
‘NaT’ will return NaT where there are nonexistent times
timedelta objects will shift nonexistent times by the timedelta
‘raise’ will raise an NonExistentTimeError if there are nonexistent times.
Index of the same type for a DatetimeIndex or TimedeltaIndex, or a Series with the same index for a Series.
Notes
If the timestamps have a timezone, ceiling will take place relative to the local (“wall”) time and re-localized to the same timezone. When ceiling near daylight savings time, use nonexistent and ambiguous to control the re-localization behavior.
Examples
DatetimeIndex
Series
When rounding near a daylight savings time transition, use ambiguous or nonexistent to control how the timestamp should be re-localized.


Return a Dataframe of the components of the Timedeltas.
Examples


Returns numpy array of python datetime.date objects.
Namely, the date part of Timestamps without time and timezone information.


Return the day names of the DateTimeIndex with specified locale.
Locale determining the language in which to return the day name. Default is English locale.
Index of day names.
Examples


The day of the week with Monday=0, Sunday=6.
Return the day of the week. It is assumed the week starts on Monday, which is denoted by 0 and ends on Sunday which is denoted by 6. This method is available on both Series with datetime values (using the dt accessor) or DatetimeIndex.
Containing integers indicating the day number.
See also
Alias.
Alias.
Returns the name of the day of the week.
Examples


Perform floor operation on the data to the specified freq.
The frequency level to floor the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.
Only relevant for DatetimeIndex:
‘infer’ will attempt to infer fall dst-transition hours based on order
bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times)
‘NaT’ will return NaT where there are ambiguous times
‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.
A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.
‘shift_forward’ will shift the nonexistent time forward to the closest existing time
‘shift_backward’ will shift the nonexistent time backward to the closest existing time
‘NaT’ will return NaT where there are nonexistent times
timedelta objects will shift nonexistent times by the timedelta
‘raise’ will raise an NonExistentTimeError if there are nonexistent times.
Index of the same type for a DatetimeIndex or TimedeltaIndex, or a Series with the same index for a Series.
Notes
If the timestamps have a timezone, flooring will take place relative to the local (“wall”) time and re-localized to the same timezone. When flooring near daylight savings time, use nonexistent and ambiguous to control the re-localization behavior.
Examples
DatetimeIndex
Series
When rounding near a daylight savings time transition, use ambiguous or nonexistent to control how the timestamp should be re-localized.


Boolean indicator if the date belongs to a leap year.
A leap year is a year, which has 366 days (instead of 365) including 29th of February as an intercalary day. Leap years are years which are multiples of four with the exception of years divisible by 100 but not by 400.
Booleans indicating if dates belong to a leap year.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


Indicates whether the date is the last day of the month.
For Series, returns a Series with boolean values. For DatetimeIndex, returns a boolean array.
See also
Return a boolean indicating whether the date is the first day of the month.
Return a boolean indicating whether the date is the last day of the month.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


Indicates whether the date is the first day of the month.
For Series, returns a Series with boolean values. For DatetimeIndex, returns a boolean array.
See also
Return a boolean indicating whether the date is the first day of the month.
Return a boolean indicating whether the date is the last day of the month.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


Indicator for whether the date is the last day of a quarter.
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
See also
Return the quarter of the date.
Similar property indicating the quarter start.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


Indicator for whether the date is the first day of a quarter.
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
See also
Return the quarter of the date.
Similar property for indicating the quarter start.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


Indicate whether the date is the last day of the year.
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
See also
Similar property indicating the start of the year.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


Indicate whether the date is the first day of a year.
The same type as the original data with boolean values. Series will have the same name and index. DatetimeIndex will have the same name.
See also
Similar property indicating the last day of the year.
Examples
This method is available on Series with datetime values under the .dt accessor, and directly on DatetimeIndex.


The microseconds of the datetime.
Examples


Number of microseconds (>= 0 and less than 1 second) for each element.


The month as January=1, December=12.
Examples


Return the month names of the DateTimeIndex with specified locale.
Locale determining the language in which to return the month name. Default is English locale.
Index of month names.
Examples


The nanoseconds of the datetime.
Examples


Number of nanoseconds (>= 0 and less than 1 microsecond) for each element.


Convert times to midnight.
The time component of the date-time is converted to midnight i.e. 00:00:00. This is useful in cases, when the time does not matter. Length is unaltered. The timezones are unaffected.
This method is available on Series with datetime values under the .dt accessor, and directly on Datetime Array/Index.
The same type as the original data. Series will have the same name and index. DatetimeIndex will have the same name.
See also
Floor the datetimes to the specified freq.
Ceil the datetimes to the specified freq.
Round the datetimes to the specified freq.
Examples


Perform round operation on the data to the specified freq.
The frequency level to round the index to. Must be a fixed frequency like ‘S’ (second) not ‘ME’ (month end). See frequency aliases for a list of possible freq values.
Only relevant for DatetimeIndex:
‘infer’ will attempt to infer fall dst-transition hours based on order
bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times)
‘NaT’ will return NaT where there are ambiguous times
‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.
A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.
‘shift_forward’ will shift the nonexistent time forward to the closest existing time
‘shift_backward’ will shift the nonexistent time backward to the closest existing time
‘NaT’ will return NaT where there are nonexistent times
timedelta objects will shift nonexistent times by the timedelta
‘raise’ will raise an NonExistentTimeError if there are nonexistent times.
Index of the same type for a DatetimeIndex or TimedeltaIndex, or a Series with the same index for a Series.
Notes
If the timestamps have a timezone, rounding will take place relative to the local (“wall”) time and re-localized to the same timezone. When rounding near daylight savings time, use nonexistent and ambiguous to control the re-localization behavior.
Examples
DatetimeIndex
Series
When rounding near a daylight savings time transition, use ambiguous or nonexistent to control how the timestamp should be re-localized.


Number of seconds (>= 0 and less than 1 day) for each element.


Convert to Index using specified date_format.
Return an Index of formatted strings specified by date_format, which supports the same string format as the python standard library. Details of the string format can be found in python string format doc.
Date format string (e.g. “%Y-%m-%d”).
NumPy ndarray of formatted strings.
See also
Convert the given argument to datetime.
Return DatetimeIndex with times to midnight.
Round the DatetimeIndex to the specified freq.
Floor the DatetimeIndex to the specified freq.
Examples


Returns numpy array of datetime.time objects.
The time part of the Timestamps.


Returns numpy array of datetime.time objects with timezone information.
The time part of the Timestamps.


Cast to PeriodArray/Index at a particular frequency.
Converts DatetimeArray/Index to PeriodArray/Index.
One of pandas’ offset strings or an Offset object. Will be inferred by default.
When converting a DatetimeArray/Index with non-regular values, so that a frequency cannot be inferred.
See also
Immutable ndarray holding ordinal values.
Return DatetimeIndex as object.
Examples
Infer the daily frequency


Return the data as an array of datetime.datetime objects.
Timezone information is retained if present.
Warning
Python’s datetime uses microsecond resolution, which is lower than pandas (nanosecond). The values are truncated.
Object dtype array containing native Python datetime objects.
See also
Standard library value for a datetime.
Examples
pandas’ nanosecond precision is truncated to microseconds.


Return an array of native datetime.timedelta objects.
Python’s standard datetime library uses a different representation timedelta’s. This method converts a Series of pandas Timedeltas to datetime.timedelta format with the same length as the original Series.
Array of 1D containing data with datetime.timedelta type.
See also
A duration expressing the difference between two date, time, or datetime.
Examples


Return total duration of each element expressed in seconds.
This method is available directly on TimedeltaArray, TimedeltaIndex and on Series containing timedelta values under the .dt namespace.
When the calling object is a TimedeltaArray, the return type is ndarray. When the calling object is a TimedeltaIndex, the return type is a Float64Index. When the calling object is a Series, the return type is Series of type float64 whose index is the same as the original.
See also
Standard library version of this method.
Return a DataFrame with components of each Timedelta.
Examples
Series
TimedeltaIndex


Return the timezone.
Returns None when the array is tz-naive.


Convert tz-aware Datetime Array/Index from one time zone to another.
Time zone for time. Corresponding timestamps would be converted to this time zone of the Datetime Array/Index. A tz of None will convert to UTC and remove the timezone information.
If Datetime Array/Index is tz-naive.
See also
A timezone that has a variable offset from UTC.
Localize tz-naive DatetimeIndex to a given time zone, or remove timezone from a tz-aware DatetimeIndex.
Examples
With the tz parameter, we can change the DatetimeIndex to other time zones:
With the tz=None, we can remove the timezone (after converting to UTC if necessary):


Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index.
This method takes a time zone (tz) naive Datetime Array/Index object and makes this time zone aware. It does not move the time to another time zone.
This method can also be used to do the inverse – to create a time zone unaware object from an aware object. To that end, pass tz=None.
Time zone to convert timestamps to. Passing None will remove the time zone information preserving local time.
When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from 03:00 DST to 02:00 non-DST, 02:30:00 local time occurs both at 00:30:00 UTC and at 01:30:00 UTC. In such a situation, the ambiguous parameter dictates how ambiguous times should be handled.
‘infer’ will attempt to infer fall dst-transition hours based on order
bool-ndarray where True signifies a DST time, False signifies a non-DST time (note that this flag is only applicable for ambiguous times)
‘NaT’ will return NaT where there are ambiguous times
‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.
A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST.
‘shift_forward’ will shift the nonexistent time forward to the closest existing time
‘shift_backward’ will shift the nonexistent time backward to the closest existing time
‘NaT’ will return NaT where there are nonexistent times
timedelta objects will shift nonexistent times by the timedelta
‘raise’ will raise an NonExistentTimeError if there are nonexistent times.
Array/Index converted to the specified time zone.
If the Datetime Array/Index is tz-aware and tz is not None.
See also
Convert tz-aware DatetimeIndex from one time zone to another.
Examples
Localize DatetimeIndex in US/Eastern time zone:
With the tz=None, we can remove the time zone information while keeping the local time (not converted to UTC):
Be careful with DST changes. When there is sequential data, pandas can infer the DST time:
In some cases, inferring the DST is impossible. In such cases, you can pass an ndarray to the ambiguous parameter to set the DST explicitly
If the DST transition causes nonexistent times, you can shift these dates forward or backwards with a timedelta object or ‘shift_forward’ or ‘shift_backwards’.


The week ordinal of the year.
Deprecated since version 1.1.0.
Series.dt.weekofyear and Series.dt.week have been deprecated. Please use Series.dt.isocalendar().week instead.


The day of the week with Monday=0, Sunday=6.
Return the day of the week. It is assumed the week starts on Monday, which is denoted by 0 and ends on Sunday which is denoted by 6. This method is available on both Series with datetime values (using the dt accessor) or DatetimeIndex.
Containing integers indicating the day number.
See also
Alias.
Alias.
Returns the name of the day of the week.
Examples


Return the dtype object of the underlying data.


Indicate duplicate Series values.
Duplicated values are indicated as True values in the resulting Series. Either all duplicates, all except the first or all except the last occurrence of duplicates can be indicated.
Method to handle dropping duplicates:
‘first’ : Mark duplicates as True except for the first occurrence.
‘last’ : Mark duplicates as True except for the last occurrence.
False : Mark all duplicates as True.
Series indicating whether each value has occurred in the preceding values.
See also
Equivalent method on pandas.Index.
Equivalent method on pandas.DataFrame.
Remove duplicate values from Series.
Examples
By default, for each set of duplicated values, the first occurrence is set on False and all others on True:
which is equivalent to
By using ‘last’, the last occurrence of each set of duplicated values is set on False and all others on True:
By setting keep on False, all duplicates are True:


Indicator whether Series/DataFrame is empty.
True if Series/DataFrame is entirely empty (no items), meaning any of the axes are of length 0.
If Series/DataFrame is empty, return True, if not return False.
See also
Return series without null values.
Return DataFrame with labels on given axis omitted where (all or any) data are missing.
Notes
If Series/DataFrame contains only NaNs, it is still not considered empty. See the example below.
Examples
An example of an actual empty DataFrame. Notice the index is empty:
If we only have NaNs in our DataFrame, it is not considered empty! We will need to drop the NaNs to make the DataFrame empty:


Return Equal to of series and other, element-wise (binary operator eq).
Equivalent to series == other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
Examples


Test whether two objects contain the same elements.
This function allows two Series or DataFrames to be compared against each other to see if they have the same shape and elements. NaNs in the same location are considered equal.
The row/column index do not need to have the same type, as long as the values are considered equal. Corresponding columns must be of the same dtype.
The other Series or DataFrame to be compared with the first.
True if all elements are the same in both objects, False otherwise.
See also
Compare two Series objects of the same length and return a Series where each element is True if the element in each Series is equal, False otherwise.
Compare two DataFrame objects of the same shape and return a DataFrame where each element is True if the respective element in each DataFrame is equal, False otherwise.
Raises an AssertionError if left and right are not equal. Provides an easy interface to ignore inequality in dtypes, indexes and precision among others.
Like assert_series_equal, but targets DataFrames.
Return True if two arrays have the same shape and elements, False otherwise.
Examples
DataFrames df and exactly_equal have the same types and values for their elements and column labels, which will return True.
DataFrames df and different_column_type have the same element types and values, but have different types for the column labels, which will still return True.
DataFrames df and different_data_type have different types for the same values for their elements, and will return False even though their column labels are the same values and types.


Provide exponentially weighted (EW) calculations.
Exactly one parameter: com, span, halflife, or alpha must be provided.
Specify decay in terms of center of mass
\(\alpha = 1 / (1 + com)\), for \(com \geq 0\).
Specify decay in terms of span
\(\alpha = 2 / (span + 1)\), for \(span \geq 1\).
Specify decay in terms of half-life
\(\alpha = 1 - \exp\left(-\ln(2) / halflife\right)\), for \(halflife > 0\).
If times is specified, the time unit (str or timedelta) over which an observation decays to half its value. Only applicable to mean(), and halflife value will not apply to the other functions.
New in version 1.1.0.
Specify smoothing factor \(\alpha\) directly
\(0 < \alpha \leq 1\).
Minimum number of observations in window required to have a value; otherwise, result is np.nan.
Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings (viewing EWMA as a moving average).
When adjust=True (default), the EW function is calculated using weights \(w_i = (1 - \alpha)^i\). For example, the EW moving average of the series [\(x_0, x_1, ..., x_t\)] would be:
When adjust=False, the exponentially weighted function is calculated recursively:
Ignore missing values when calculating weights.
When ignore_na=False (default), weights are based on absolute positions. For example, the weights of \(x_0\) and \(x_2\) used in calculating the final weighted average of [\(x_0\), None, \(x_2\)] are \((1-\alpha)^2\) and \(1\) if adjust=True, and \((1-\alpha)^2\) and \(\alpha\) if adjust=False.
When ignore_na=True, weights are based on relative positions. For example, the weights of \(x_0\) and \(x_2\) used in calculating the final weighted average of [\(x_0\), None, \(x_2\)] are \(1-\alpha\) and \(1\) if adjust=True, and \(1-\alpha\) and \(\alpha\) if adjust=False.
If 0 or 'index', calculate across the rows.
If 1 or 'columns', calculate across the columns.
New in version 1.1.0.
Only applicable to mean().
Times corresponding to the observations. Must be monotonically increasing and datetime64[ns] dtype.
If 1-D array like, a sequence with the same shape as the observations.
Deprecated since version 1.4.0: If str, the name of the column in the DataFrame representing the times.
New in version 1.4.0.
Execute the rolling operation per single column or row ('single') or over the entire object ('table').
This argument is only implemented when specifying engine='numba' in the method call.
Only applicable to mean()
See also
Provides rolling window calculations.
Provides expanding transformations.
Notes
See Windowing Operations for further usage details and examples.
Examples
adjust
ignore_na
times
Exponentially weighted mean with weights calculated with a timedelta halflife relative to times.


Provide expanding window calculations.
Minimum number of observations in window required to have a value; otherwise, result is np.nan.
If False, set the window labels as the right edge of the window index.
If True, set the window labels as the center of the window index.
Deprecated since version 1.1.0.
If 0 or 'index', roll across the rows.
If 1 or 'columns', roll across the columns.
Execute the rolling operation per single column or row ('single') or over the entire object ('table').
This argument is only implemented when specifying engine='numba' in the method call.
New in version 1.3.0.
See also
Provides rolling window calculations.
Provides exponential weighted functions.
Notes
See Windowing Operations for further usage details and examples.
Examples
min_periods
Expanding sum with 1 vs 3 observations needed to calculate a value.


Transform each element of a list-like to a row.
New in version 0.25.0.
If True, the resulting index will be labeled 0, 1, …, n - 1.
New in version 1.1.0.
Exploded lists to rows; index will be duplicated for these rows.
See also
Split string values on specified separator.
Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame.
Unpivot a DataFrame from wide format to long format.
Explode a DataFrame from list-like columns to long format.
Notes
This routine will explode list-likes including lists, tuples, sets, Series, and np.ndarray. The result dtype of the subset rows will be object. Scalars will be returned unchanged, and empty list-likes will result in a np.nan for that row. In addition, the ordering of elements in the output will be non-deterministic when exploding sets.
Examples


Encode the object as an enumerated type or categorical variable.
This method is useful for obtaining a numeric representation of an array when all that matters is identifying distinct values. factorize is available as both a top-level function pandas.factorize(), and as a method Series.factorize() and Index.factorize().
Sort uniques and shuffle codes to maintain the relationship.
Value to mark “not found”. If None, will not drop the NaN from the uniques of the values.
Changed in version 1.1.2.
An integer ndarray that’s an indexer into uniques. uniques.take(codes) will have the same values as values.
The unique valid values. When values is Categorical, uniques is a Categorical. When values is some other pandas object, an Index is returned. Otherwise, a 1-D ndarray is returned.
Note
Even if there’s a missing value in values, uniques will not contain an entry for it.
See also
Discretize continuous-valued array.
Find the unique value in an array.
Examples
These examples all show factorize as a top-level method like pd.factorize(values). The results are identical for methods like Series.factorize().
With sort=True, the uniques will be sorted, and codes will be shuffled so that the relationship is the maintained.
Missing values are indicated in codes with na_sentinel (-1 by default). Note that missing values are never included in uniques.
Thus far, we’ve only factorized lists (which are internally coerced to NumPy arrays). When factorizing pandas objects, the type of uniques will differ. For Categoricals, a Categorical is returned.
Notice that 'b' is in uniques.categories, despite not being present in cat.values.
For all other pandas objects, an Index of the appropriate type is returned.
If NaN is in the values, and we want to include NaN in the uniques of the values, it can be achieved by setting na_sentinel=None.


Synonym for DataFrame.fillna() with method='ffill'.
Object with missing values filled or None if inplace=True.


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 be a list.
Method to use for filling holes in reindexed Series pad / ffill: propagate last valid observation forward to next valid backfill / bfill: use next valid observation to fill gap.
Axis along which to fill missing values.
If True, fill in-place. Note: this will modify any other views on this object (e.g., a no-copy slice for a column in a DataFrame).
If method is specified, this is the maximum number of consecutive NaN values to forward/backward fill. In other words, if there is a gap with more than this number of consecutive NaNs, it will only be partially filled. If method is not specified, this is the maximum number of entries along the entire axis where NaNs will be filled. Must be greater than 0 if not None.
A dict of item->dtype of what to downcast if possible, or the string ‘infer’ which will try to downcast to an appropriate equal type (e.g. float64 to int64 if possible).
Object with missing values filled or None if inplace=True.
See also
Fill NaN values using interpolation.
Conform object to new index.
Convert TimeSeries to specified frequency.
Examples
Replace all NaN elements with 0s.
We can also propagate non-null values forward or backward.
Replace all NaN elements in column ‘A’, ‘B’, ‘C’, and ‘D’, with 0, 1, 2, and 3 respectively.
Only replace the first NaN element.
When filling using a DataFrame, replacement happens along the same column names and same indices
Note that column D is not affected since it is not present in df2.


Subset the dataframe rows or columns according to the specified index labels.
Note that this routine does not filter a dataframe on its contents. The filter is applied to the labels of the index.
Keep labels from axis which are in items.
Keep labels from axis for which “like in label == True”.
Keep labels from axis for which re.search(regex, label) == True.
The axis to filter on, expressed either as an index (int) or axis name (str). By default this is the info axis, ‘index’ for Series, ‘columns’ for DataFrame.
See also
Access a group of rows and columns by label(s) or a boolean array.
Notes
The items, like, and regex parameters are enforced to be mutually exclusive.
axis defaults to the info axis that is used when indexing with [].
Examples


Select initial periods of time series data based on a date offset.
When having a DataFrame with dates as index, this function can select the first few rows based on a date offset.
The offset length of the data that will be selected. For instance, ‘1M’ will display all the rows having their index within the first month.
A subset of the caller.
If the index is not a DatetimeIndex
See also
Select final periods of time series based on a date offset.
Select values at a particular time of the day.
Select values between particular times of the day.
Examples
Get the rows for the first 3 days:
Notice the data for 3 first calendar days were returned, not the first 3 days observed in the dataset, and therefore data for 2018-04-13 was not returned.


Return index for first non-NA value or None, if no NA value is found.
Notes
If all elements are non-NA/null, returns None. Also returns None for empty Series/DataFrame.


Get the properties associated with this pandas object.
The available flags are
Flags.allows_duplicate_labels
See also
Flags that apply to pandas objects.
Global metadata applying to this dataset.
Notes
“Flags” differ from “metadata”. Flags reflect properties of the pandas object (the Series or DataFrame). Metadata refer to properties of the dataset, and should be stored in DataFrame.attrs.
Examples
Flags can be get or set using .
Or by slicing with a key


Return Integer division of series and other, element-wise (binary operator floordiv).
Equivalent to series // other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Reverse of the Integer division operator, see Python documentation for more details.
Examples


Return Greater than or equal to of series and other, element-wise (binary operator ge).
Equivalent to series >= other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
Examples


Get item from object for given key (ex: DataFrame column).
Returns default value if not found.
Examples
If the key isn’t found, the default value will be used.


Group Series using a mapper or by a Series of columns.
A groupby operation involves some combination of splitting the object, applying a function, and combining the results. This can be used to group large amounts of data and compute operations on these groups.
Used to determine the groups for the groupby. If by is a function, it’s called on each value of the object’s index. If a dict or Series is passed, the Series or dict VALUES will be used to determine the groups (the Series’ values are first aligned; see .align() method). If a list or ndarray of length equal to the selected axis is passed (see the groupby user guide), the values are used as-is to determine the groups. A label or list of labels may be passed to group by the columns in self. Notice that a tuple is interpreted as a (single) key.
Split along rows (0) or columns (1).
If the axis is a MultiIndex (hierarchical), group by a particular level or levels.
For aggregated output, return object with group labels as the index. Only relevant for DataFrame input. as_index=False is effectively “SQL-style” grouped output.
Sort group keys. Get better performance by turning this off. Note this does not influence the order of observations within each group. Groupby preserves the order of rows within each group.
When calling apply, add group keys to index to identify pieces.
Reduce the dimensionality of the return type if possible, otherwise return a consistent type.
Deprecated since version 1.1.0.
This only applies if any of the groupers are Categoricals. If True: only show observed values for categorical groupers. If False: show all values for categorical groupers.
If True, and if group keys contain NA values, NA values together with row/column will be dropped. If False, NA values will also be treated as the key in groups.
New in version 1.1.0.
Returns a groupby object that contains information about the groups.
See also
Convenience method for frequency conversion and resampling of time series.
Notes
See the user guide for more detailed usage and examples, including splitting an object into groups, iterating through groups, selecting a group, aggregation, and more.
Examples
Grouping by Indexes
We can groupby different levels of a hierarchical index using the level parameter:
We can also choose to include NA in group keys or not by defining dropna parameter, the default setting is True.


Return Greater than of series and other, element-wise (binary operator gt).
Equivalent to series > other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
Examples


Return True if there are any NaNs.
Enables various performance speedups.


Return the first n rows.
This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it.
For negative values of n, this function returns all rows except the last n rows, equivalent to df[:-n].
Number of rows to select.
The first n rows of the caller object.
See also
Returns the last n rows.
Examples
Viewing the first 5 lines
Viewing the first n lines (three in this case)
For negative values of n


Draw histogram of the input series using matplotlib.
If passed, then used to form histograms for separate groups.
If not passed, uses gca().
Whether to show axis grid lines.
If specified changes the x-axis label size.
Rotation of x axis labels.
If specified changes the y-axis label size.
Rotation of y axis labels.
Figure size in inches by default.
Number of histogram bins to be used. If an integer is given, bins + 1 bin edges are calculated and returned. If bins is a sequence, gives bin edges, including left edge of first bin and right edge of last bin. In this case, bins is returned unmodified.
Backend to use instead of the backend specified in the option plotting.backend. For instance, ‘matplotlib’. Alternatively, to specify the plotting.backend for the whole session, set pd.options.plotting.backend.
New in version 1.0.0.
Whether to show the legend.
New in version 1.1.0.
To be passed to the actual plotting function.
A histogram plot.
See also
Plot a histogram using matplotlib.


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.
When integer position is out of bounds.
See also
Access a single value for a row/column label pair.
Access a group of rows and columns by label(s).
Access a group of rows and columns by integer position(s).
Examples
Get value at specified row/column pair
Set value at specified row/column pair
Get value within a series


Return the row label of the maximum value.
If multiple values equal the maximum, the first row label with that value is returned.
For compatibility with DataFrame.idxmax. Redundant for application on Series.
Exclude NA/null values. If the entire Series is NA, the result will be NA.
Additional arguments and keywords have no effect but might be accepted for compatibility with NumPy.
Label of the maximum value.
If the Series is empty.
See also
Return indices of the maximum values along the given axis.
Return index of first occurrence of maximum over requested axis.
Return index label of the first occurrence of minimum of values.
Notes
This method is the Series version of ndarray.argmax. This method returns the label of the maximum, while ndarray.argmax returns the position. To get the position, use series.values.argmax().
Examples
If skipna is False and there is an NA value in the data, the function returns nan.


Return the row label of the minimum value.
If multiple values equal the minimum, the first row label with that value is returned.
For compatibility with DataFrame.idxmin. Redundant for application on Series.
Exclude NA/null values. If the entire Series is NA, the result will be NA.
Additional arguments and keywords have no effect but might be accepted for compatibility with NumPy.
Label of the minimum value.
If the Series is empty.
See also
Return indices of the minimum values along the given axis.
Return index of first occurrence of minimum over requested axis.
Return index label of the first occurrence of maximum of values.
Notes
This method is the Series version of ndarray.argmin. This method returns the label of the minimum, while ndarray.argmin returns the position. To get the position, use series.values.argmin().
Examples
If skipna is False and there is an NA value in the data, the function returns nan.


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 with ints, e.g. 1:7.
A boolean array.
A callable function with one argument (the calling Series or DataFrame) and that returns valid output for indexing (one of the above). This is useful in method chains, when you don’t have a reference to the calling object, but would like to base your selection on some value.
.iloc will raise IndexError if a requested indexer is out-of-bounds, except slice indexers which allow out-of-bounds indexing (this conforms with python/numpy slice semantics).
See more at Selection by Position.
See also
Fast integer location scalar accessor.
Purely label-location based indexer for selection by label.
Purely integer-location based indexing for selection by position.
Examples
Indexing just the rows
With a scalar integer.
With a list of integers.
With a slice object.
With a boolean mask the same length as the index.
With a callable, useful in method chains. The x passed to the lambda is the DataFrame being sliced. This selects the rows whose index label even.
Indexing both axes
You can mix the indexer types for the index and columns. Use : to select the entire axis.
With scalar integers.
With lists of integers.
With slice objects.
With a boolean array whose length matches the columns.
With a callable function that expects the Series or DataFrame.


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.
See also
Convert argument to datetime.
Convert argument to timedelta.
Convert argument to numeric type.
Convert argument to best possible dtype.
Examples


Print a concise summary of a Series.
This method prints information about a Series including the index dtype, non-null values and memory usage.
New in version 1.4.0.
Series to print information about.
Whether to print the full summary. By default, the setting in pandas.options.display.max_info_columns is followed.
Where to send the output. By default, the output is printed to sys.stdout. Pass a writable buffer if you need to further process the output.
Specifies whether total memory usage of the Series elements (including the index) should be displayed. By default, this follows the pandas.options.display.memory_usage setting.
True always show memory usage. False never shows memory usage. A value of ‘deep’ is equivalent to “True with deep introspection”. Memory usage is shown in human-readable units (base-2 representation). Without deep introspection a memory estimation is made based in column dtype and number of rows assuming values consume the same memory amount for corresponding dtypes. With deep memory introspection, a real memory usage calculation is performed at the cost of computational resources.
Whether to show the non-null counts. By default, this is shown only if the DataFrame is smaller than pandas.options.display.max_info_rows and pandas.options.display.max_info_columns. A value of True always shows the counts, and False never shows the counts.
This method prints a summary of a Series and returns None.
See also
Generate descriptive statistics of Series.
Memory usage of Series.
Examples
Prints a summary excluding information about its values:
Pipe output of Series.info to buffer instead of sys.stdout, get buffer content and writes to a text file:
The memory_usage parameter allows deep introspection mode, specially useful for big Series and fine-tune memory optimization:


Fill NaN values using an interpolation method.
Please note that only method='linear' is supported for DataFrame/Series with a MultiIndex.
Interpolation technique to use. One of:
‘linear’: Ignore the index and treat the values as equally spaced. This is the only method supported on MultiIndexes.
‘time’: Works on daily and higher resolution data to interpolate given length of interval.
‘index’, ‘values’: use the actual numerical values of the index.
‘pad’: Fill in NaNs using existing values.
‘nearest’, ‘zero’, ‘slinear’, ‘quadratic’, ‘cubic’, ‘spline’, ‘barycentric’, ‘polynomial’: Passed to scipy.interpolate.interp1d. These methods use the numerical values of the index. Both ‘polynomial’ and ‘spline’ require that you also specify an order (int), e.g. df.interpolate(method='polynomial', order=5).
‘krogh’, ‘piecewise_polynomial’, ‘spline’, ‘pchip’, ‘akima’, ‘cubicspline’: Wrappers around the SciPy interpolation methods of similar names. See Notes.
‘from_derivatives’: Refers to scipy.interpolate.BPoly.from_derivatives which replaces ‘piecewise_polynomial’ interpolation method in scipy 0.18.
Axis to interpolate along.
Maximum number of consecutive NaNs to fill. Must be greater than 0.
Update the data in place if possible.
Consecutive NaNs will be filled in this direction.
If ‘method’ is ‘pad’ or ‘ffill’, ‘limit_direction’ must be ‘forward’.
If ‘method’ is ‘backfill’ or ‘bfill’, ‘limit_direction’ must be ‘backwards’.
If ‘method’ is ‘backfill’ or ‘bfill’, the default is ‘backward’
else the default is ‘forward’
Changed in version 1.1.0: raises ValueError if limit_direction is ‘forward’ or ‘both’ and method is ‘backfill’ or ‘bfill’. raises ValueError if limit_direction is ‘backward’ or ‘both’ and method is ‘pad’ or ‘ffill’.
If limit is specified, consecutive NaNs will be filled with this restriction.
None: No fill restriction.
‘inside’: Only fill NaNs surrounded by valid values (interpolate).
‘outside’: Only fill NaNs outside valid values (extrapolate).
Downcast dtypes if possible.
Keyword arguments to pass on to the interpolating function.
Returns the same object type as the caller, interpolated at some or all NaN values or None if inplace=True.
See also
Fill missing values using different methods.
Piecewise cubic polynomials (Akima interpolator).
Piecewise polynomial in the Bernstein basis.
Interpolate a 1-D function.
Interpolate polynomial (Krogh interpolator).
PCHIP 1-d monotonic cubic interpolation.
Cubic spline data interpolator.
Notes
The ‘krogh’, ‘piecewise_polynomial’, ‘spline’, ‘pchip’ and ‘akima’ methods are wrappers around the respective SciPy implementations of similar names. These use the actual numerical values of the index. For more information on their behavior, see the SciPy documentation and SciPy tutorial.
Examples
Filling in NaN in a Series via linear interpolation.
Filling in NaN in a Series by padding, but filling at most two consecutive NaN at a time.
Filling in NaN in a Series via polynomial interpolation or splines: Both ‘polynomial’ and ‘spline’ methods require that you also specify an order (int).
Fill the DataFrame forward (that is, going down) along each column using linear interpolation.
Note how the last entry in column ‘a’ is interpolated differently, because there is no entry after it to use for interpolation. Note how the first entry in column ‘b’ remains NaN, because there is no entry before it to use for interpolation.
Using polynomial interpolation.


Return boolean if values in the object are monotonic_increasing.


Return boolean if values in the object are monotonic_decreasing.


Return boolean if values in the object are unique.


Whether elements in Series are contained in values.
Return a boolean Series showing whether each element in the Series matches an element in the passed sequence of values exactly.
The sequence of values to test. Passing in a single string will raise a TypeError. Instead, turn a single string into a list of one element.
Series of booleans indicating if each element is in values.
If values is a string
See also
Equivalent method on DataFrame.
Examples
To invert the boolean values, use the ~ operator:
Passing a single string as s.isin('lama') will raise an error. Use a list of one element instead:
Strings and integers are distinct and are therefore not comparable:


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 set pandas.options.mode.use_inf_as_na = True).
Mask of bool values for each element in Series that indicates whether an element is an NA value.
See also
Alias of isna.
Boolean inverse of isna.
Omit axes labels with missing values.
Top-level isna.
Examples
Show which entries in a DataFrame are NA.
Show which entries in a Series are NA.


Series.isnull is an alias for Series.isna.
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 set pandas.options.mode.use_inf_as_na = True).
Mask of bool values for each element in Series that indicates whether an element is an NA value.
See also
Alias of isna.
Boolean inverse of isna.
Omit axes labels with missing values.
Top-level isna.
Examples
Show which entries in a DataFrame are NA.
Show which entries in a Series are NA.


Return the first element of the underlying data as a Python scalar.
The first element of %(klass)s.
If the data is not length-1.


Lazily iterate over (index, value) tuples.
This method returns an iterable tuple (index, value). This is convenient if you want to create a lazy iterator.
Iterable of tuples containing the (index, value) pairs from a Series.
See also
Iterate over (column name, Series) pairs.
Iterate over DataFrame rows as (index, Series) pairs.
Examples


Return alias for index.
Index of the Series.


Return unbiased kurtosis over requested axis.
Kurtosis obtained using Fisher’s definition of kurtosis (kurtosis of normal == 0.0). Normalized by N-1.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Additional keyword arguments to be passed to the function.


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.
The offset length of the data that will be selected. For instance, ‘3D’ will display all the rows having their index within the last 3 days.
A subset of the caller.
If the index is not a DatetimeIndex
See also
Select initial periods of time series based on a date offset.
Select values at a particular time of the day.
Select values between particular times of the day.
Examples
Get the rows for the last 3 days:
Notice the data for 3 last calendar days were returned, not the last 3 observed days in the dataset, and therefore data for 2018-04-11 was not returned.


Return index for last non-NA value or None, if no NA value is found.
Notes
If all elements are non-NA/null, returns None. Also returns None for empty Series/DataFrame.


Return Less than or equal to of series and other, element-wise (binary operator le).
Equivalent to series <= other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
Examples


Access a group of rows and columns by label(s) or a boolean array.
.loc[] is primarily label based, but may also be used with a boolean array.
Allowed inputs are:
A single label, e.g. 5 or 'a', (note that 5 is interpreted as a label of the index, and never as an integer position along the index).
A list or array of labels, e.g. ['a', 'b', 'c'].
A slice object with labels, e.g. 'a':'f'.
Warning
Note that contrary to usual python slices, both the start and the stop are included
A boolean array of the same length as the axis being sliced, e.g. [True, False, True].
An alignable boolean Series. The index of the key will be aligned before masking.
An alignable Index. The Index of the returned selection will be the input.
A callable function with one argument (the calling Series or DataFrame) and that returns valid output for indexing (one of the above)
See more at Selection by Label.
If any items are not found.
If an indexed key is passed and its index is unalignable to the frame index.
See also
Access a single value for a row/column label pair.
Access group of rows and columns by integer position(s).
Returns a cross-section (row(s) or column(s)) from the Series/DataFrame.
Access group of values using labels.
Examples
Getting values
Single label. Note this returns the row as a Series.
List of labels. Note using [[]] returns a DataFrame.
Single label for row and column
Slice with labels for row and single label for column. As mentioned above, note that both the start and stop of the slice are included.
Boolean list with the same length as the row axis
Alignable boolean Series:
Index (same behavior as df.reindex)
Conditional that returns a boolean Series
Conditional that returns a boolean Series with column labels specified
Callable that returns a boolean Series
Setting values
Set value for all items matching the list of labels
Set value for an entire row
Set value for an entire column
Set value for rows matching callable condition
Getting values on a DataFrame with an index that has integer labels
Another example using integers for the index
Slice with integer labels for rows. As mentioned above, note that both the start and stop of the slice are included.
Getting values with a MultiIndex
A number of examples using a DataFrame with a MultiIndex
Single label. Note this returns a DataFrame with a single index.
Single index tuple. Note this returns a Series.
Single label for row and column. Similar to passing in a tuple, this returns a Series.
Single tuple. Note using [[]] returns a DataFrame.
Single tuple for the index with a single label for the column
Slice from index tuple to single label
Slice from index tuple to index tuple


Return Less than of series and other, element-wise (binary operator lt).
Equivalent to series < other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
Examples


Return the mean absolute deviation of the values over the requested axis.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.


Map values of Series according to an input mapping or function.
Used for substituting each value in a Series with another value, that may be derived from a function, a dict or a Series.
Mapping correspondence.
If ‘ignore’, propagate NaN values, without passing them to the mapping correspondence.
Same index as caller.
See also
For applying more complex functions on a Series.
Apply a function row-/column-wise.
Apply a function elementwise on a whole DataFrame.
Notes
When arg is a dictionary, values in Series that are not in the dictionary (as keys) are converted to NaN. However, if the dictionary is a dict subclass that defines __missing__ (i.e. provides a method for default values), then this default is used rather than NaN.
Examples
map accepts a dict or a Series. Values that are not found in the dict are converted to NaN, unless the dict has a default value (e.g. defaultdict):
It also accepts a function:
To avoid applying the function to missing values (and keep them as NaN) na_action='ignore' can be used:


Replace values where the condition is True.
Where cond is False, keep the original value. Where True, replace with corresponding value from other. If cond is callable, it is computed on the Series/DataFrame and should return boolean Series/DataFrame or array. The callable must not change input Series/DataFrame (though pandas doesn’t check it).
Entries where cond is True are replaced with corresponding value from other. If other is callable, it is computed on the Series/DataFrame and should return scalar or Series/DataFrame. The callable must not change input Series/DataFrame (though pandas doesn’t check it).
Whether to perform the operation in place on the data.
Alignment axis if needed.
Alignment level if needed.
Note that currently this parameter won’t affect the results and will always coerce to a suitable dtype.
‘raise’ : allow exceptions to be raised.
‘ignore’ : suppress exceptions. On error return original object.
Try to cast the result back to the input type (if possible).
Deprecated since version 1.3.0: Manually cast back if necessary.
See also
Return an object of same shape as self.
Notes
The mask method is an application of the if-then idiom. For each element in the calling DataFrame, if cond is False the element is used; otherwise the corresponding element from the DataFrame other is used.
The signature for DataFrame.where() differs from numpy.where(). Roughly df1.where(m, df2) is equivalent to np.where(m, df1, df2).
For further details and examples see the mask documentation in indexing.
Examples


Return the maximum of the values over the requested axis.
If you want the index of the maximum, use idxmax. This is the equivalent of the numpy.ndarray method argmax.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Additional keyword arguments to be passed to the function.
See also
Return the sum.
Return the minimum.
Return the maximum.
Return the index of the minimum.
Return the index of the maximum.
Return the sum over the requested axis.
Return the minimum over the requested axis.
Return the maximum over the requested axis.
Return the index of the minimum over the requested axis.
Return the index of the maximum over the requested axis.
Examples


Return the mean of the values over the requested axis.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Additional keyword arguments to be passed to the function.


Return the median of the values over the requested axis.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Additional keyword arguments to be passed to the function.


Return the memory usage of the Series.
The memory usage can optionally include the contribution of the index and of elements of object dtype.
Specifies whether to include the memory usage of the Series index.
If True, introspect the data deeply by interrogating object dtypes for system-level memory consumption, and include it in the returned value.
Bytes of memory consumed.
See also
Total bytes consumed by the elements of the array.
Bytes consumed by a DataFrame.
Examples
Not including the index gives the size of the rest of the data, which is necessarily smaller:
The memory footprint of object values is ignored by default:


Return the minimum of the values over the requested axis.
If you want the index of the minimum, use idxmin. This is the equivalent of the numpy.ndarray method argmin.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
Additional keyword arguments to be passed to the function.
See also
Return the sum.
Return the minimum.
Return the maximum.
Return the index of the minimum.
Return the index of the maximum.
Return the sum over the requested axis.
Return the minimum over the requested axis.
Return the maximum over the requested axis.
Return the index of the minimum over the requested axis.
Return the index of the maximum over the requested axis.
Examples


Return Modulo of series and other, element-wise (binary operator mod).
Equivalent to series % other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Reverse of the Modulo operator, see Python documentation for more details.
Examples


Return the mode(s) of the Series.
The mode is the value that appears most often. There can be multiple modes.
Always returns Series even if only one value is returned.
Don’t consider counts of NaN/NaT.
Modes of the Series in sorted order.


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.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Reverse of the Multiplication operator, see Python documentation for more details.
Examples


Return the name of the Series.
The name of a Series becomes its index or column name if it is used to form a DataFrame. It is also used whenever displaying the Series using the interpreter.
The name of the Series, also the column name if part of a DataFrame.
See also
Sets the Series name when given a scalar input.
Corresponding Index property.
Examples
The Series name can be set initially when calling the constructor.
The name of a Series within a DataFrame is its column name.


Return the number of bytes in the underlying data.


Number of dimensions of the underlying data, by definition 1.


Return Not equal to of series and other, element-wise (binary operator ne).
Equivalent to series != other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
Examples


Return the largest n elements.
Return this many descending sorted values.
When there are duplicate values that cannot all fit in a Series of n elements:
first : return the first n occurrences in order of appearance.
last : return the last n occurrences in reverse order of appearance.
all : keep all occurrences. This can result in a Series of size larger than n.
The n largest values in the Series, sorted in decreasing order.
See also
Get the n smallest elements.
Sort Series by values.
Return the first n rows.
Notes
Faster than .sort_values(ascending=False).head(n) for small n relative to the size of the Series object.
Examples
The n largest elements where n=5 by default.
The n largest elements where n=3. Default keep value is ‘first’ so Malta will be kept.
The n largest elements where n=3 and keeping the last duplicates. Brunei will be kept since it is the last with value 434000 based on the index order.
The n largest elements where n=3 with all duplicates kept. Note that the returned Series has five elements due to the three duplicates.


Detect existing (non-missing) values.
Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True). NA values, such as None or numpy.NaN, get mapped to False values.
Mask of bool values for each element in Series that indicates whether an element is not an NA value.
See also
Alias of notna.
Boolean inverse of notna.
Omit axes labels with missing values.
Top-level notna.
Examples
Show which entries in a DataFrame are not NA.
Show which entries in a Series are not NA.


Series.notnull is an alias for Series.notna.
Detect existing (non-missing) values.
Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to True. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True). NA values, such as None or numpy.NaN, get mapped to False values.
Mask of bool values for each element in Series that indicates whether an element is not an NA value.
See also
Alias of notna.
Boolean inverse of notna.
Omit axes labels with missing values.
Top-level notna.
Examples
Show which entries in a DataFrame are not NA.
Show which entries in a Series are not NA.


Return the smallest n elements.
Return this many ascending sorted values.
When there are duplicate values that cannot all fit in a Series of n elements:
first : return the first n occurrences in order of appearance.
last : return the last n occurrences in reverse order of appearance.
all : keep all occurrences. This can result in a Series of size larger than n.
The n smallest values in the Series, sorted in increasing order.
See also
Get the n largest elements.
Sort Series by values.
Return the first n rows.
Notes
Faster than .sort_values().head(n) for small n relative to the size of the Series object.
Examples
The n smallest elements where n=5 by default.
The n smallest elements where n=3. Default keep value is ‘first’ so Nauru and Tuvalu will be kept.
The n smallest elements where n=3 and keeping the last duplicates. Anguilla and Tuvalu will be kept since they are the last with value 11300 based on the index order.
The n smallest elements where n=3 with all duplicates kept. Note that the returned Series has four elements due to the three duplicates.


Return number of unique elements in the object.
Excludes NA values by default.
Don’t include NaN in the count.
See also
Method nunique for DataFrame.
Count non-NA/null observations in the Series.
Examples


Synonym for DataFrame.fillna() with method='ffill'.
Object with missing values filled or None if inplace=True.


Percentage change between the current and a prior element.
Computes the percentage change from the immediately previous row by default. This is useful in comparing the percentage of change in a time series of elements.
Periods to shift for forming percent change.
How to handle NAs before computing percent changes.
The number of consecutive NAs to fill before stopping.
Increment to use from time series API (e.g. ‘M’ or BDay()).
Additional keyword arguments are passed into DataFrame.shift or Series.shift.
The same type as the calling object.
See also
Compute the difference of two elements in a Series.
Compute the difference of two elements in a DataFrame.
Shift the index by some number of periods.
Shift the index by some number of periods.
Examples
Series
See the percentage change in a Series where filling NAs with last valid observation forward to next valid.
DataFrame
Percentage change in French franc, Deutsche Mark, and Italian lira from 1980-01-01 to 1980-03-01.
Percentage of change in GOOG and APPL stock volume. Shows computing the percentage change between columns.


Apply chainable functions that expect Series or DataFrames.
Function to apply to the Series/DataFrame. args, and kwargs are passed into func. Alternatively a (callable, data_keyword) tuple where data_keyword is a string indicating the keyword of callable that expects the Series/DataFrame.
Positional arguments passed into func.
A dictionary of keyword arguments passed into func.
See also
Apply a function along input axis of DataFrame.
Apply a function elementwise on a whole DataFrame.
Apply a mapping correspondence on a Series.
Notes
Use .pipe when chaining together functions that expect Series, DataFrames or GroupBy objects. Instead of writing
You can write
If you have a function that takes the data as (say) the second argument, pass a tuple indicating which keyword expects the data. For example, suppose f takes its data as arg2:


Make plots of Series or DataFrame.
Uses the backend specified by the option plotting.backend. By default, matplotlib is used.
The object for which the method is called.
Only used if data is a DataFrame.
Allows plotting of one column versus another. Only used if data is a DataFrame.
The kind of plot to produce:
‘line’ : line plot (default)
‘bar’ : vertical bar plot
‘barh’ : horizontal bar plot
‘hist’ : histogram
‘box’ : boxplot
‘kde’ : Kernel Density Estimation plot
‘density’ : same as ‘kde’
‘area’ : area plot
‘pie’ : pie plot
‘scatter’ : scatter plot (DataFrame only)
‘hexbin’ : hexbin plot (DataFrame only)
An axes of the current figure.
Make separate subplots for each column.
In case subplots=True, share x axis and set some x axis labels to invisible; defaults to True if ax is None otherwise False if an ax is passed in; Be aware, that passing in both an ax and sharex=True will alter all x axis labels for all axis in a figure.
In case subplots=True, share y axis and set some y axis labels to invisible.
(rows, columns) for the layout of subplots.
Size of a figure object.
Use index as ticks for x axis.
Title to use for the plot. If a string is passed, print the string at the top of the figure. If a list is passed and subplots is True, print each item in the list above the corresponding subplot.
Axis grid lines.
Place legend on axis subplots.
The matplotlib line style per column.
Use log scaling or symlog scaling on x axis. .. versionchanged:: 0.25.0
Use log scaling or symlog scaling on y axis. .. versionchanged:: 0.25.0
Use log scaling or symlog scaling on both x and y axes. .. versionchanged:: 0.25.0
Values to use for the xticks.
Values to use for the yticks.
Set the x limits of the current axes.
Set the y limits of the current axes.
Name to use for the xlabel on x-axis. Default uses index name as xlabel, or the x-column name for planar plots.
New in version 1.1.0.
Changed in version 1.2.0: Now applicable to planar plots (scatter, hexbin).
Name to use for the ylabel on y-axis. Default will show no ylabel, or the y-column name for planar plots.
New in version 1.1.0.
Changed in version 1.2.0: Now applicable to planar plots (scatter, hexbin).
Rotation for ticks (xticks for vertical, yticks for horizontal plots).
Font size for xticks and yticks.
Colormap to select colors from. If string, load colormap with that name from matplotlib.
If True, plot colorbar (only relevant for ‘scatter’ and ‘hexbin’ plots).
Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center).
If True, draw a table using the data in the DataFrame and the data will be transposed to meet matplotlib’s default layout. If a Series or DataFrame is passed, use passed data to draw a table.
See Plotting with Error Bars for detail.
Equivalent to yerr.
If True, create stacked plot.
Sort column names to determine plot ordering.
Whether to plot on the secondary y-axis if a list/tuple, which columns to plot on secondary y-axis.
When using a secondary_y axis, automatically mark the column labels with “(right)” in the legend.
If True, boolean values can be plotted.
Backend to use instead of the backend specified in the option plotting.backend. For instance, ‘matplotlib’. Alternatively, to specify the plotting.backend for the whole session, set pd.options.plotting.backend.
New in version 1.0.0.
Options to pass to matplotlib plotting method.
If the backend is not the default matplotlib one, the return value will be the object returned by the backend.
Notes
See matplotlib documentation online for more on this subject
If kind = ‘bar’ or ‘barh’, you can specify relative alignments for bar plot layout by position keyword. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center)


Draw a stacked area plot.
An area plot displays quantitative data visually. This function wraps the matplotlib area function.
Coordinates for the X axis. By default uses the index.
Column to plot. By default uses all columns.
Area plots are stacked by default. Set to False to create a unstacked plot.
Additional keyword arguments are documented in DataFrame.plot().
Area plot, or array of area plots if subplots is True.
See also
Make plots of DataFrame using matplotlib / pylab.
Examples
Draw an area plot based on basic business metrics:
Area plots are stacked by default. To produce an unstacked plot, pass stacked=False:
Draw an area plot for a single column:
Draw with a different x:


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 compared, and the other axis represents a measured value.
Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
Allows plotting of one column versus another. If not specified, all numerical columns are used.
The color for each of the DataFrame’s columns. Possible values are:
for instance ‘red’ or ‘#a98d19’.
code, which will be used for each column recursively. For instance [‘green’,’yellow’] each column’s bar will be filled in green or yellow, alternatively. If there is only a single column to be plotted, then only the first color from the color list will be used.
colored accordingly. For example, if your columns are called a and b, then passing {‘a’: ‘green’, ‘b’: ‘red’} will color bars for column a in green and bars for column b in red.
New in version 1.1.0.
Additional keyword arguments are documented in DataFrame.plot().
An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.
See also
Horizontal bar plot.
Make plots of a DataFrame.
Make a bar plot with matplotlib.
Examples
Basic plot.
Plot a whole dataframe to a bar plot. Each column is assigned a distinct color, and each row is nested in a group along the horizontal axis.
Plot stacked bar charts for the DataFrame
Instead of nesting, the figure can be split by column with subplots=True. In this case, a numpy.ndarray of matplotlib.axes.Axes are returned.
If you don’t like the default colours, you can specify how you’d like each column to be colored.
Plot a single column.
Plot only selected categories for the DataFrame.


Make a horizontal bar plot.
A horizontal bar plot is a plot that presents quantitative 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 compared, and the other axis represents a measured value.
Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
Allows plotting of one column versus another. If not specified, all numerical columns are used.
The color for each of the DataFrame’s columns. Possible values are:
for instance ‘red’ or ‘#a98d19’.
code, which will be used for each column recursively. For instance [‘green’,’yellow’] each column’s bar will be filled in green or yellow, alternatively. If there is only a single column to be plotted, then only the first color from the color list will be used.
colored accordingly. For example, if your columns are called a and b, then passing {‘a’: ‘green’, ‘b’: ‘red’} will color bars for column a in green and bars for column b in red.
New in version 1.1.0.
Additional keyword arguments are documented in DataFrame.plot().
An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.
See also
Vertical bar plot.
Make plots of DataFrame using matplotlib.
Plot a vertical bar plot using matplotlib.
Examples
Basic example
Plot a whole DataFrame to a horizontal bar plot
Plot stacked barh charts for the DataFrame
We can specify colors for each column
Plot a column of the DataFrame to a horizontal bar plot
Plot DataFrame versus the desired column


Make a box plot of the DataFrame columns.
A box plot is a method for graphically depicting groups of numerical data through their quartiles. The box extends from the Q1 to Q3 quartile values of the data, with a line at the median (Q2). The whiskers extend from the edges of box to show the range of the data. The position of the whiskers is set by default to 1.5*IQR (IQR = Q3 - Q1) from the edges of the box. Outlier points are those past the end of the whiskers.
For further details see Wikipedia’s entry for boxplot.
A consideration when using this chart is that the box and the whiskers can overlap, which is very common when plotting small sets of data.
Column in the DataFrame to group by.
Changed in version 1.4.0: Previously, by is silently ignore and makes no groupings
Additional keywords are documented in DataFrame.plot().
See also
Another method to draw a box plot.
Draw a box plot from a Series object.
Draw a box plot in matplotlib.
Examples
Draw a box plot from a DataFrame with four columns of randomly generated data.
You can also generate groupings if you specify the by parameter (which can take a column name, or a list or tuple of column names):
Changed in version 1.4.0.


Generate Kernel Density Estimate plot using Gaussian kernels.
In statistics, kernel density estimation (KDE) is a non-parametric way to estimate the probability density function (PDF) of a random variable. This function uses Gaussian kernels and includes automatic bandwidth determination.
The method used to calculate the estimator bandwidth. This can be ‘scott’, ‘silverman’, a scalar constant or a callable. If None (default), ‘scott’ is used. See scipy.stats.gaussian_kde for more information.
Evaluation points for the estimated PDF. If None (default), 1000 equally spaced points are used. If ind is a NumPy array, the KDE is evaluated at the points passed. If ind is an integer, ind number of equally spaced points are used.
Additional keyword arguments are documented in pandas.%(this-datatype)s.plot().
See also
Representation of a kernel-density estimate using Gaussian kernels. This is the function used internally to estimate the PDF.
Examples
Given a Series of points randomly sampled from an unknown distribution, estimate its PDF using KDE with automatic bandwidth determination and plot the results, evaluating them at 1000 equally spaced points (default):
A scalar bandwidth can be specified. Using a small bandwidth value can lead to over-fitting, while using a large bandwidth value may result in under-fitting:
Finally, the ind parameter determines the evaluation points for the plot of the estimated PDF:
For DataFrame, it works in the same way:
A scalar bandwidth can be specified. Using a small bandwidth value can lead to over-fitting, while using a large bandwidth value may result in under-fitting:
Finally, the ind parameter determines the evaluation points for the plot of the estimated PDF:


Draw one histogram of the DataFrame’s columns.
A histogram is a representation of the distribution of data. This function groups the values of all given Series in the DataFrame into bins and draws all bins in one matplotlib.axes.Axes. This is useful when the DataFrame’s Series are in a similar scale.
Column in the DataFrame to group by.
Changed in version 1.4.0: Previously, by is silently ignore and makes no groupings
Number of histogram bins to be used.
Additional keyword arguments are documented in DataFrame.plot().
Return a histogram plot.
See also
Draw histograms per DataFrame’s Series.
Draw a histogram with Series’ data.
Examples
When we roll a die 6000 times, we expect to get each value around 1000 times. But when we roll two dice and sum the result, the distribution is going to be quite different. A histogram illustrates those distributions.
A grouped histogram can be generated by providing the parameter by (which can be a column name, or a list of column names):


Plot Series or DataFrame as lines.
This function is useful to plot lines using DataFrame’s values as coordinates.
Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
Allows plotting of one column versus another. If not specified, all numerical columns are used.
The color for each of the DataFrame’s columns. Possible values are:
for instance ‘red’ or ‘#a98d19’.
code, which will be used for each column recursively. For instance [‘green’,’yellow’] each column’s line will be filled in green or yellow, alternatively. If there is only a single column to be plotted, then only the first color from the color list will be used.
colored accordingly. For example, if your columns are called a and b, then passing {‘a’: ‘green’, ‘b’: ‘red’} will color lines for column a in green and lines for column b in red.
New in version 1.1.0.
Additional keyword arguments are documented in DataFrame.plot().
An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.
See also
Plot y versus x as lines and/or markers.
Examples
The following example shows the populations for some animals over the years.
An example with subplots, so an array of axes is returned.
Let’s repeat the same example, but specifying colors for each column (in this case, for each animal).
The following example shows the relationship between both populations.


Generate a pie plot.
A pie plot is a proportional representation of the numerical data in a column. This function wraps matplotlib.pyplot.pie() for the specified column. If no column reference is passed and subplots=True a pie plot is drawn for each numerical column independently.
Label or position of the column to plot. If not provided, subplots=True argument must be passed.
Keyword arguments to pass on to DataFrame.plot().
A NumPy array is returned when subplots is True.
See also
Generate a pie plot for a Series.
Make plots of a DataFrame.
Examples
In the example below we have a DataFrame with the information about planet’s mass and radius. We pass the ‘mass’ column to the pie function to get a pie plot.


Return item and drops from series. Raise KeyError if not found.
Index of the element that needs to be removed.
Examples


Return Exponential power of series and other, element-wise (binary operator pow).
Equivalent to series ** other, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Reverse of the Exponential power operator, see Python documentation for more details.
Examples


Return the product of the values over the requested axis.
Axis for the function to be applied on.
Exclude NA/null values when computing the result.
If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
The required number of valid values to perform the operation. If fewer than min_count non-NA values are present the result will be NA.
Additional keyword arguments to be passed to the function.
See also
Return the sum.
Return the minimum.
Return the maximum.
Return the index of the minimum.
Return the index of the maximum.
Return the sum over the requested axis.
Return the minimum over the requested axis.
Return the maximum over the requested axis.
Return the index of the minimum over the requested axis.
Return the index of the maximum over the requested axis.
Examples
By default, the product of an empty or all-NA Series is 1
This can be controlled with the min_count parameter
Thanks to the skipna parameter, min_count handles all-NA and empty series identically.


Return value at the given quantile.
The quantile(s) to compute, which can lie in range: 0 <= q <= 1.
This optional parameter specifies the interpolation method to use, when the desired quantile lies between two data points i and j:
linear: i + (j - i) * fraction, where fraction is the fractional part of the index surrounded by i and j.
lower: i.
higher: j.
nearest: i or j whichever is nearest.
midpoint: (i + j) / 2.
If q is an array, a Series will be returned where the index is q and the values are the quantiles, otherwise a float will be returned.
See also
Calculate the rolling quantile.
Returns the q-th percentile(s) of the array elements.
Examples


Return Addition of series and other, element-wise (binary operator radd).
Equivalent to other + series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Addition, see Python documentation for more details.
Examples


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.
Index to direct ranking.
How to rank the group of records that have the same value (i.e. ties):
average: average rank of the group
min: lowest rank in the group
max: highest rank in the group
first: ranks assigned in order they appear in the array
dense: like ‘min’, but rank always increases by 1 between groups.
For DataFrame objects, rank only numeric columns if set to True.
How to rank NaN values:
keep: assign NaN rank to NaN values
top: assign lowest rank to NaN values
bottom: assign highest rank to NaN values
Whether or not the elements should be ranked in ascending order.
Whether or not to display the returned rankings in percentile form.
Return a Series or DataFrame with data ranks as values.
See also
Rank of values within each group.
Examples
The following example shows how the method behaves with the above parameters:
default_rank: this is the default behaviour obtained without using any parameter.
max_rank: setting method = 'max' the records that have the same values are ranked using the highest rank (e.g.: since ‘cat’ and ‘dog’ are both in the 2nd and 3rd position, rank 3 is assigned.)
NA_bottom: choosing na_option = 'bottom', if there are records with NaN values they are placed at the bottom of the ranking.
pct_rank: when setting pct = True, the ranking is expressed as percentile rank.


Return the flattened underlying data as an ndarray.
Flattened data of the Series.
See also
Return a flattened array.


Return Floating division of series and other, element-wise (binary operator rtruediv).
Equivalent to other / series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Floating division, see Python documentation for more details.
Examples


Return Integer division and modulo of series and other, element-wise (binary operator rdivmod).
Equivalent to other divmod series, but with support to substitute a fill_value for missing data in either one of the inputs.
Fill existing missing (NaN) values, and any new element needed for successful Series alignment, with this value before computation. If data in both corresponding Series locations is missing the result of filling (at that location) will be missing.
Broadcast across a level, matching Index values on the passed MultiIndex level.
The result of the operation.
See also
Element-wise Integer division and modulo, see Python documentation for more details.
Examples


Conform Series to new index with optional filling logic.
Places NA/NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and copy=False.
New labels / index to conform to, should be specified using keywords. Preferably an Index object to avoid duplicating data.
Method to use for filling holes in reindexed DataFrame. Please note: this is only applicable to DataFrames/Series with a monotonically increasing/decreasing index.
None (default): don’t fill gaps
pad / ffill: Propagate last valid observation forward to next valid.
backfill / bfill: Use next valid observation to fill gap.
nearest: Use nearest valid observations to fill gap.
Return a new object, even if the passed indexes are the same.
Broadcast across a level, matching Index values on the passed MultiIndex level.
Value to use for missing values. Defaults to NaN, but can be any “compatible” value.
Maximum number of consecutive elements to forward or backward fill.
Maximum distance between original and new labels for inexact matches. The values of the index at the matching locations most satisfy the equation abs(index[indexer] - target) <= tolerance.
Tolerance may be a scalar value, which applies the same tolerance to all values, or list-like, which applies variable tolerance per element. List-like includes list, tuple, array, Series, and must be the same size as the index and its dtype must exactly match the index’s type.
See also
Set row labels.
Remove row labels or move them to new columns.
Change to same indices as other DataFrame.
Examples
DataFrame.reindex supports two calling conventions
(index=index_labels, columns=column_labels, ...)
(labels, axis={'index', 'columns'}, ...)
We highly recommend using keyword arguments to clarify your intent.
Create a dataframe with some fictional data.
Create a new index and reindex the dataframe. By default values in the new index that do not have corresponding records in the dataframe are assigned NaN.
We can fill in the missing values by passing a value to the keyword fill_value. Because the index is not monotonically increasing or decreasing, we cannot use arguments to the keyword method to fill the NaN values.
We can also reindex the columns.
Or we can use “axis-style” keyword arguments
To further illustrate the filling functionality in reindex, we will create a dataframe with a monotonically increasing index (for example, a sequence of dates).
Suppose we decide to expand the dataframe to cover a wider date range.
The index entries that did not have a value in the original data frame (for example, ‘2009-12-29’) are by default filled with NaN. If desired, we can fill in the missing values using one of several options.
For example, to back-propagate the last valid value to fill the NaN values, pass bfill as an argument to the method keyword.
Please note that the NaN value present in the original dataframe (at index value 2010-01-03) will not be filled by any of the value propagation schemes. This is because filling while reindexing does not look at dataframe values, but only compares the original and desired indexes. If you do want to fill in the NaN values present in the original dataframe, use the fillna() method.
See the user guide for more.


Return an object with matching indices as other object.
Conform the object to the same index on all axes. Optional filling logic, placing NaN in locations having no value in the previous index. A new object is produced unless the new index is equivalent to the current one and copy=False.
Its row and column indices are used to define the new indices of this object.
Method to use for filling holes in reindexed DataFrame. Please note: this is only applicable to DataFrames/Series with a monotonically increasing/decreasing index.
None (default): don’t fill gaps
pad / ffill: propagate last valid observation forward to next valid
backfill / bfill: use next valid observation to fill gap
nearest: use nearest valid observations to fill gap.
Return a new object, even if the passed indexes are the same.
Maximum number of consecutive labels to fill for inexact matches.
Maximum distance between original and new labels for inexact matches. The values of the index at the matching locations must satisfy the equation abs(index[indexer] - target) <= tolerance.
Tolerance may be a scalar value, which applies the same tolerance to all values, or list-like, which applies variable tolerance per element. List-like includes list, tuple, array, Series, and must be the same size as the index and its dtype must exactly match the index’s type.
Same type as caller, but with changed indices on each axis.
See also
Set row labels.
Remove row labels or move them to new columns.
Change to new indices or expand indices.
Notes
Same as calling .reindex(index=other.index, columns=other.columns,...).
Examples


Alter Series index labels or name.
Function / dict values must be unique (1-to-1). Labels not contained in a dict / Series will be left as-is. Extra labels listed don’t throw an error.
Alternatively, change Series.name with a scalar value.
See the user guide for more.
Unused. Accepted for compatibility with DataFrame method only.
Functions or dict-like are transformations to apply to the index. Scalar or hashable sequence-like will alter the Series.name attribute.
Additional keyword arguments passed to the function. Only the “inplace” keyword is used.
Series with index labels or name altered or None if inplace=True.
See also
Corresponding DataFrame method.
Set the name of the axis.
Examples


Set the name of the axis for the index or columns.
Value to set the axis name attribute.
A scalar, list-like, dict-like or functions transformations to apply to that axis’ values. Note that the columns parameter is not allowed if the object is a Series. This parameter only apply for DataFrame type objects.
Use either mapper and axis to specify the axis to target with mapper, or index and/or columns.
The axis to rename.
Also copy underlying data.
Modifies the object directly, instead of creating a new Series or DataFrame.
The same type as the caller or None if inplace=True.
See also
Alter Series index labels or name.
Alter DataFrame index labels or name.
Set new names on index.
Notes
DataFrame.rename_axis supports two calling conventions
(index=index_mapper, columns=columns_mapper, ...)
(mapper, axis={'index', 'columns'}, ...)
The first calling convention will only modify the names of the index and/or the names of the Index object that is the columns. In this case, the parameter copy is ignored.
The second calling convention will modify the names of the corresponding index if mapper is a list or a scalar. However, if mapper is dict-like or a function, it will use the deprecated behavior of modifying the axis labels.
We highly recommend using keyword arguments to clarify your intent.
Examples
Series
DataFrame
MultiIndex


Rearrange index levels using input order.
May not drop or duplicate levels.
Reference level by number or key.


Repeat elements of a Series.
Returns a new Series where each element of the current Series is repeated consecutively a given number of times.
The number of repetitions for each element. This should be a non-negative integer. Repeating 0 times will return an empty Series.
Must be None. Has no effect but is accepted for compatibility with numpy.
Newly created Series with repeated elements.
See also
Equivalent function for Index.
Similar method for numpy.ndarray.
Examples