pandas.Series.idxmin   Series.idxmin(axis=0, skipna=True, *args, **kwargs)[source]

Return the row label of the minimum value. If multiple values equal the minimum, the first row label with that value is returned.  Parameters

axis:int, default 0

For compatibility with DataFrame.idxmin. Redundant for application on Series.
skipna:bool, default True

Exclude NA/null values. If the entire Series is NA, the result will be NA.  *args, **kwargs

Additional arguments and keywords have no effect but might be accepted for compatibility with NumPy.    Returns
 Index

Label of the minimum value.    Raises
 ValueError

If the Series is empty.      See also  numpy.argmin

Return indices of the minimum values along the given axis.  DataFrame.idxmin

Return index of first occurrence of minimum over requested axis.  Series.idxmax

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
>>> s = pd.Series(data=[1, None, 4, 1],
...               index=['A', 'B', 'C', 'D'])
>>> s
A    1.0
B    NaN
C    4.0
D    1.0
dtype: float64

>>> s.idxmin()
'A'
  If skipna is False and there is an NA value in the data, the function returns nan.
>>> s.idxmin(skipna=False)
nan


pandas.Series.iloc   propertySeries.iloc

Purely integer-location based indexing for selection by position. .iloc[] is primarily integer position based (from 0 to length-1 of the axis), but may also be used with a boolean array. 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  DataFrame.iat

Fast integer location scalar accessor.  DataFrame.loc

Purely label-location based indexer for selection by label.  Series.iloc

Purely integer-location based indexing for selection by position.    Examples
>>> mydict = [{'a': 1, 'b': 2, 'c': 3, 'd': 4},
...           {'a': 100, 'b': 200, 'c': 300, 'd': 400},
...           {'a': 1000, 'b': 2000, 'c': 3000, 'd': 4000 }]
>>> df = pd.DataFrame(mydict)
>>> df
      a     b     c     d
0     1     2     3     4
1   100   200   300   400
2  1000  2000  3000  4000
  Indexing just the rows With a scalar integer.
>>> type(df.iloc[0])
<class 'pandas.core.series.Series'>
>>> df.iloc[0]
a    1
b    2
c    3
d    4
Name: 0, dtype: int64
  With a list of integers.
>>> df.iloc[[0]]
   a  b  c  d
0  1  2  3  4
>>> type(df.iloc[[0]])
<class 'pandas.core.frame.DataFrame'>

>>> df.iloc[[0, 1]]
     a    b    c    d
0    1    2    3    4
1  100  200  300  400
  With a slice object.
>>> df.iloc[:3]
      a     b     c     d
0     1     2     3     4
1   100   200   300   400
2  1000  2000  3000  4000
  With a boolean mask the same length as the index.
>>> df.iloc[[True, False, True]]
      a     b     c     d
0     1     2     3     4
2  1000  2000  3000  4000
  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.
>>> df.iloc[lambda x: x.index % 2 == 0]
      a     b     c     d
0     1     2     3     4
2  1000  2000  3000  4000
  Indexing both axes You can mix the indexer types for the index and columns. Use : to select the entire axis. With scalar integers.
>>> df.iloc[0, 1]
2
  With lists of integers.
>>> df.iloc[[0, 2], [1, 3]]
      b     d
0     2     4
2  2000  4000
  With slice objects.
>>> df.iloc[1:3, 0:3]
      a     b     c
1   100   200   300
2  1000  2000  3000
  With a boolean array whose length matches the columns.
>>> df.iloc[:, [True, False, True, False]]
      a     c
0     1     3
1   100   300
2  1000  3000
  With a callable function that expects the Series or DataFrame.
>>> df.iloc[:, lambda df: [0, 2]]
      a     c
0     1     3
1   100   300
2  1000  3000


pandas.Series.index   Series.index

The index (axis labels) of the Series.


pandas.Series.infer_objects   Series.infer_objects()[source]

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.  Returns

converted:same type as input object

    See also  to_datetime

Convert argument to datetime.  to_timedelta

Convert argument to timedelta.  to_numeric

Convert argument to numeric type.  convert_dtypes

Convert argument to best possible dtype.    Examples
>>> df = pd.DataFrame({"A": ["a", 1, 2, 3]})
>>> df = df.iloc[1:]
>>> df
   A
1  1
2  2
3  3

>>> df.dtypes
A    object
dtype: object

>>> df.infer_objects().dtypes
A    int64
dtype: object


pandas.Series.info   Series.info(verbose=None, buf=None, max_cols=None, memory_usage=None, show_counts=True)[source]

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.   Parameters

data:Series

Series to print information about.
verbose:bool, optional

Whether to print the full summary. By default, the setting in pandas.options.display.max_info_columns is followed.
buf:writable buffer, defaults to sys.stdout

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.
memory_usage:bool, str, optional

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.
show_counts:bool, optional

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.    Returns
 None

This method prints a summary of a Series and returns None.      See also  Series.describe

Generate descriptive statistics of Series.  Series.memory_usage

Memory usage of Series.    Examples
>>> int_values = [1, 2, 3, 4, 5]
>>> text_values = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']
>>> s = pd.Series(text_values, index=int_values)
>>> s.info()
<class 'pandas.core.series.Series'>
Int64Index: 5 entries, 1 to 5
Series name: None
Non-Null Count  Dtype
--------------  -----
5 non-null      object
dtypes: object(1)
memory usage: 80.0+ bytes
  Prints a summary excluding information about its values:
>>> s.info(verbose=False)
<class 'pandas.core.series.Series'>
Int64Index: 5 entries, 1 to 5
dtypes: object(1)
memory usage: 80.0+ bytes
  Pipe output of Series.info to buffer instead of sys.stdout, get buffer content and writes to a text file:
>>> import io
>>> buffer = io.StringIO()
>>> s.info(buf=buffer)
>>> s = buffer.getvalue()
>>> with open("df_info.txt", "w",
...           encoding="utf-8") as f:
...     f.write(s)
260
  The memory_usage parameter allows deep introspection mode, specially useful for big Series and fine-tune memory optimization:
>>> random_strings_array = np.random.choice(['a', 'b', 'c'], 10 ** 6)
>>> s = pd.Series(np.random.choice(['a', 'b', 'c'], 10 ** 6))
>>> s.info()
<class 'pandas.core.series.Series'>
RangeIndex: 1000000 entries, 0 to 999999
Series name: None
Non-Null Count    Dtype
--------------    -----
1000000 non-null  object
dtypes: object(1)
memory usage: 7.6+ MB

>>> s.info(memory_usage='deep')
<class 'pandas.core.series.Series'>
RangeIndex: 1000000 entries, 0 to 999999
Series name: None
Non-Null Count    Dtype
--------------    -----
1000000 non-null  object
dtypes: object(1)
memory usage: 55.3 MB


pandas.Series.interpolate   Series.interpolate(method='linear', axis=0, limit=None, inplace=False, limit_direction=None, limit_area=None, downcast=None, **kwargs)[source]

Fill NaN values using an interpolation method. Please note that only method='linear' is supported for DataFrame/Series with a MultiIndex.  Parameters

method:str, default ‘linear’

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:{{0 or ‘index’, 1 or ‘columns’, None}}, default None

Axis to interpolate along.
limit:int, optional

Maximum number of consecutive NaNs to fill. Must be greater than 0.
inplace:bool, default False

Update the data in place if possible.
limit_direction:{{‘forward’, ‘backward’, ‘both’}}, Optional

Consecutive NaNs will be filled in this direction.  If limit is specified:

 If ‘method’ is ‘pad’ or ‘ffill’, ‘limit_direction’ must be ‘forward’. If ‘method’ is ‘backfill’ or ‘bfill’, ‘limit_direction’ must be ‘backwards’.   If ‘limit’ is not specified:

 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’.
limit_area:{{None, ‘inside’, ‘outside’}}, default None

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:optional, ‘infer’ or None, defaults to None

Downcast dtypes if possible.
``**kwargs``:optional

Keyword arguments to pass on to the interpolating function.    Returns
 Series or DataFrame or None

Returns the same object type as the caller, interpolated at some or all NaN values or None if inplace=True.      See also  fillna

Fill missing values using different methods.  scipy.interpolate.Akima1DInterpolator

Piecewise cubic polynomials (Akima interpolator).  scipy.interpolate.BPoly.from_derivatives

Piecewise polynomial in the Bernstein basis.  scipy.interpolate.interp1d

Interpolate a 1-D function.  scipy.interpolate.KroghInterpolator

Interpolate polynomial (Krogh interpolator).  scipy.interpolate.PchipInterpolator

PCHIP 1-d monotonic cubic interpolation.  scipy.interpolate.CubicSpline

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.
>>> s = pd.Series([0, 1, np.nan, 3])
>>> s
0    0.0
1    1.0
2    NaN
3    3.0
dtype: float64
>>> s.interpolate()
0    0.0
1    1.0
2    2.0
3    3.0
dtype: float64
  Filling in NaN in a Series by padding, but filling at most two consecutive NaN at a time.
>>> s = pd.Series([np.nan, "single_one", np.nan,
...                "fill_two_more", np.nan, np.nan, np.nan,
...                4.71, np.nan])
>>> s
0              NaN
1       single_one
2              NaN
3    fill_two_more
4              NaN
5              NaN
6              NaN
7             4.71
8              NaN
dtype: object
>>> s.interpolate(method='pad', limit=2)
0              NaN
1       single_one
2       single_one
3    fill_two_more
4    fill_two_more
5    fill_two_more
6              NaN
7             4.71
8             4.71
dtype: object
  Filling in NaN in a Series via polynomial interpolation or splines: Both ‘polynomial’ and ‘spline’ methods require that you also specify an order (int).
>>> s = pd.Series([0, 2, np.nan, 8])
>>> s.interpolate(method='polynomial', order=2)
0    0.000000
1    2.000000
2    4.666667
3    8.000000
dtype: float64
  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.
>>> df = pd.DataFrame([(0.0, np.nan, -1.0, 1.0),
...                    (np.nan, 2.0, np.nan, np.nan),
...                    (2.0, 3.0, np.nan, 9.0),
...                    (np.nan, 4.0, -4.0, 16.0)],
...                   columns=list('abcd'))
>>> df
     a    b    c     d
0  0.0  NaN -1.0   1.0
1  NaN  2.0  NaN   NaN
2  2.0  3.0  NaN   9.0
3  NaN  4.0 -4.0  16.0
>>> df.interpolate(method='linear', limit_direction='forward', axis=0)
     a    b    c     d
0  0.0  NaN -1.0   1.0
1  1.0  2.0 -2.0   5.0
2  2.0  3.0 -3.0   9.0
3  2.0  4.0 -4.0  16.0
  Using polynomial interpolation.
>>> df['d'].interpolate(method='polynomial', order=2)
0     1.0
1     4.0
2     9.0
3    16.0
Name: d, dtype: float64


pandas.Series.is_monotonic   propertySeries.is_monotonic

Return boolean if values in the object are monotonic_increasing.  Returns
 bool


pandas.Series.is_monotonic_decreasing   propertySeries.is_monotonic_decreasing

Return boolean if values in the object are monotonic_decreasing.  Returns
 bool


pandas.Series.is_monotonic_increasing   propertySeries.is_monotonic_increasing

Alias for is_monotonic.


pandas.Series.is_unique   propertySeries.is_unique

Return boolean if values in the object are unique.  Returns
 bool


pandas.Series.isin   Series.isin(values)[source]

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.  Parameters

values:set or list-like

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.    Returns
 Series

Series of booleans indicating if each element is in values.    Raises
 TypeError

 If values is a string       See also  DataFrame.isin

Equivalent method on DataFrame.    Examples
>>> s = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama',
...                'hippo'], name='animal')
>>> s.isin(['cow', 'lama'])
0     True
1     True
2     True
3    False
4     True
5    False
Name: animal, dtype: bool
  To invert the boolean values, use the ~ operator:
>>> ~s.isin(['cow', 'lama'])
0    False
1    False
2    False
3     True
4    False
5     True
Name: animal, dtype: bool
  Passing a single string as s.isin('lama') will raise an error. Use a list of one element instead:
>>> s.isin(['lama'])
0     True
1    False
2     True
3    False
4     True
5    False
Name: animal, dtype: bool
  Strings and integers are distinct and are therefore not comparable:
>>> pd.Series([1]).isin(['1'])
0    False
dtype: bool
>>> pd.Series([1.1]).isin(['1.1'])
0    False
dtype: bool


pandas.Series.isna   Series.isna()[source]

Detect missing values. Return a boolean same-sized object indicating if the values are NA. NA values, such as None or numpy.NaN, gets mapped to True values. Everything else gets mapped to False values. Characters such as empty strings '' or numpy.inf are not considered NA values (unless you set pandas.options.mode.use_inf_as_na = True).  Returns
 Series

Mask of bool values for each element in Series that indicates whether an element is an NA value.      See also  Series.isnull

Alias of isna.  Series.notna

Boolean inverse of isna.  Series.dropna

Omit axes labels with missing values.  isna

Top-level isna.    Examples Show which entries in a DataFrame are NA.
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker

>>> df.isna()
     age   born   name    toy
0  False   True  False   True
1  False  False  False  False
2   True  False  False  False
  Show which entries in a Series are NA.
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64

>>> ser.isna()
0    False
1    False
2     True
dtype: bool


pandas.Series.isnull   Series.isnull()[source]

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).  Returns
 Series

Mask of bool values for each element in Series that indicates whether an element is an NA value.      See also  Series.isnull

Alias of isna.  Series.notna

Boolean inverse of isna.  Series.dropna

Omit axes labels with missing values.  isna

Top-level isna.    Examples Show which entries in a DataFrame are NA.
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker

>>> df.isna()
     age   born   name    toy
0  False   True  False   True
1  False  False  False  False
2   True  False  False  False
  Show which entries in a Series are NA.
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64

>>> ser.isna()
0    False
1    False
2     True
dtype: bool


pandas.Series.item   Series.item()[source]

Return the first element of the underlying data as a Python scalar.  Returns
 scalar

The first element of %(klass)s.    Raises
 ValueError

If the data is not length-1.


pandas.Series.items   Series.items()[source]

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.  Returns
 iterable

Iterable of tuples containing the (index, value) pairs from a Series.      See also  DataFrame.items

Iterate over (column name, Series) pairs.  DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.    Examples
>>> s = pd.Series(['A', 'B', 'C'])
>>> for index, value in s.items():
...     print(f"Index : {index}, Value : {value}")
Index : 0, Value : A
Index : 1, Value : B
Index : 2, Value : C


pandas.Series.iteritems   Series.iteritems()[source]

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.  Returns
 iterable

Iterable of tuples containing the (index, value) pairs from a Series.      See also  DataFrame.items

Iterate over (column name, Series) pairs.  DataFrame.iterrows

Iterate over DataFrame rows as (index, Series) pairs.    Examples
>>> s = pd.Series(['A', 'B', 'C'])
>>> for index, value in s.items():
...     print(f"Index : {index}, Value : {value}")
Index : 0, Value : A
Index : 1, Value : B
Index : 2, Value : C


pandas.Series.keys   Series.keys()[source]

Return alias for index.  Returns
 Index

Index of the Series.


pandas.Series.kurt   Series.kurt(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]

Return unbiased kurtosis over requested axis. Kurtosis obtained using Fisher’s definition of kurtosis (kurtosis of normal == 0.0). Normalized by N-1.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)


pandas.Series.kurtosis   Series.kurtosis(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]

Return unbiased kurtosis over requested axis. Kurtosis obtained using Fisher’s definition of kurtosis (kurtosis of normal == 0.0). Normalized by N-1.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)


pandas.Series.last   Series.last(offset)[source]

Select final periods of time series data based on a date offset. For a DataFrame with a sorted DatetimeIndex, this function selects the last few rows based on a date offset.  Parameters

offset:str, DateOffset, dateutil.relativedelta

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.    Returns
 Series or DataFrame

A subset of the caller.    Raises
 TypeError

If the index is not a DatetimeIndex      See also  first

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

Select values at a particular time of the day.  between_time

Select values between particular times of the day.    Examples
>>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
>>> ts = pd.DataFrame({'A': [1, 2, 3, 4]}, index=i)
>>> ts
            A
2018-04-09  1
2018-04-11  2
2018-04-13  3
2018-04-15  4
  Get the rows for the last 3 days:
>>> ts.last('3D')
            A
2018-04-13  3
2018-04-15  4
  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.


pandas.Series.last_valid_index   Series.last_valid_index()[source]

Return index for last non-NA value or None, if no NA value is found.  Returns

scalar:type of index

   Notes If all elements are non-NA/null, returns None. Also returns None for empty Series/DataFrame.


pandas.Series.le   Series.le(other, level=None, fill_value=None, axis=0)[source]

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.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.     Examples
>>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
e    1.0
dtype: float64
>>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
>>> b
a    0.0
b    1.0
c    2.0
d    NaN
f    1.0
dtype: float64
>>> a.le(b, fill_value=0)
a    False
b     True
c     True
d    False
e    False
f     True
dtype: bool


pandas.Series.loc   propertySeries.loc

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.  Raises
 KeyError

If any items are not found.  IndexingError

If an indexed key is passed and its index is unalignable to the frame index.      See also  DataFrame.at

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

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

Returns a cross-section (row(s) or column(s)) from the Series/DataFrame.  Series.loc

Access group of values using labels.    Examples Getting values
>>> df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
...      index=['cobra', 'viper', 'sidewinder'],
...      columns=['max_speed', 'shield'])
>>> df
            max_speed  shield
cobra               1       2
viper               4       5
sidewinder          7       8
  Single label. Note this returns the row as a Series.
>>> df.loc['viper']
max_speed    4
shield       5
Name: viper, dtype: int64
  List of labels. Note using [[]] returns a DataFrame.
>>> df.loc[['viper', 'sidewinder']]
            max_speed  shield
viper               4       5
sidewinder          7       8
  Single label for row and column
>>> df.loc['cobra', 'shield']
2
  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.
>>> df.loc['cobra':'viper', 'max_speed']
cobra    1
viper    4
Name: max_speed, dtype: int64
  Boolean list with the same length as the row axis
>>> df.loc[[False, False, True]]
            max_speed  shield
sidewinder          7       8
  Alignable boolean Series:
>>> df.loc[pd.Series([False, True, False],
...        index=['viper', 'sidewinder', 'cobra'])]
            max_speed  shield
sidewinder          7       8
  Index (same behavior as df.reindex)
>>> df.loc[pd.Index(["cobra", "viper"], name="foo")]
       max_speed  shield
foo
cobra          1       2
viper          4       5
  Conditional that returns a boolean Series
>>> df.loc[df['shield'] > 6]
            max_speed  shield
sidewinder          7       8
  Conditional that returns a boolean Series with column labels specified
>>> df.loc[df['shield'] > 6, ['max_speed']]
            max_speed
sidewinder          7
  Callable that returns a boolean Series
>>> df.loc[lambda df: df['shield'] == 8]
            max_speed  shield
sidewinder          7       8
  Setting values Set value for all items matching the list of labels
>>> df.loc[['viper', 'sidewinder'], ['shield']] = 50
>>> df
            max_speed  shield
cobra               1       2
viper               4      50
sidewinder          7      50
  Set value for an entire row
>>> df.loc['cobra'] = 10
>>> df
            max_speed  shield
cobra              10      10
viper               4      50
sidewinder          7      50
  Set value for an entire column
>>> df.loc[:, 'max_speed'] = 30
>>> df
            max_speed  shield
cobra              30      10
viper              30      50
sidewinder         30      50
  Set value for rows matching callable condition
>>> df.loc[df['shield'] > 35] = 0
>>> df
            max_speed  shield
cobra              30      10
viper               0       0
sidewinder          0       0
  Getting values on a DataFrame with an index that has integer labels Another example using integers for the index
>>> df = pd.DataFrame([[1, 2], [4, 5], [7, 8]],
...      index=[7, 8, 9], columns=['max_speed', 'shield'])
>>> df
   max_speed  shield
7          1       2
8          4       5
9          7       8
  Slice with integer labels for rows. As mentioned above, note that both the start and stop of the slice are included.
>>> df.loc[7:9]
   max_speed  shield
7          1       2
8          4       5
9          7       8
  Getting values with a MultiIndex A number of examples using a DataFrame with a MultiIndex
>>> tuples = [
...    ('cobra', 'mark i'), ('cobra', 'mark ii'),
...    ('sidewinder', 'mark i'), ('sidewinder', 'mark ii'),
...    ('viper', 'mark ii'), ('viper', 'mark iii')
... ]
>>> index = pd.MultiIndex.from_tuples(tuples)
>>> values = [[12, 2], [0, 4], [10, 20],
...         [1, 4], [7, 1], [16, 36]]
>>> df = pd.DataFrame(values, columns=['max_speed', 'shield'], index=index)
>>> df
                     max_speed  shield
cobra      mark i           12       2
           mark ii           0       4
sidewinder mark i           10      20
           mark ii           1       4
viper      mark ii           7       1
           mark iii         16      36
  Single label. Note this returns a DataFrame with a single index.
>>> df.loc['cobra']
         max_speed  shield
mark i          12       2
mark ii          0       4
  Single index tuple. Note this returns a Series.
>>> df.loc[('cobra', 'mark ii')]
max_speed    0
shield       4
Name: (cobra, mark ii), dtype: int64
  Single label for row and column. Similar to passing in a tuple, this returns a Series.
>>> df.loc['cobra', 'mark i']
max_speed    12
shield        2
Name: (cobra, mark i), dtype: int64
  Single tuple. Note using [[]] returns a DataFrame.
>>> df.loc[[('cobra', 'mark ii')]]
               max_speed  shield
cobra mark ii          0       4
  Single tuple for the index with a single label for the column
>>> df.loc[('cobra', 'mark i'), 'shield']
2
  Slice from index tuple to single label
>>> df.loc[('cobra', 'mark i'):'viper']
                     max_speed  shield
cobra      mark i           12       2
           mark ii           0       4
sidewinder mark i           10      20
           mark ii           1       4
viper      mark ii           7       1
           mark iii         16      36
  Slice from index tuple to index tuple
>>> df.loc[('cobra', 'mark i'):('viper', 'mark ii')]
                    max_speed  shield
cobra      mark i          12       2
           mark ii          0       4
sidewinder mark i          10      20
           mark ii          1       4
viper      mark ii          7       1


pandas.Series.lt   Series.lt(other, level=None, fill_value=None, axis=0)[source]

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.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.     Examples
>>> a = pd.Series([1, 1, 1, np.nan, 1], index=['a', 'b', 'c', 'd', 'e'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
e    1.0
dtype: float64
>>> b = pd.Series([0, 1, 2, np.nan, 1], index=['a', 'b', 'c', 'd', 'f'])
>>> b
a    0.0
b    1.0
c    2.0
d    NaN
f    1.0
dtype: float64
>>> a.lt(b, fill_value=0)
a    False
b    False
c     True
d    False
e    False
f     True
dtype: bool


pandas.Series.mad   Series.mad(axis=None, skipna=True, level=None)[source]

Return the mean absolute deviation of the values over the requested axis.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.    Returns
 scalar or Series (if level specified)


pandas.Series.map   Series.map(arg, na_action=None)[source]

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.  Parameters

arg:function, collections.abc.Mapping subclass or Series

Mapping correspondence.
na_action:{None, ‘ignore’}, default None

If ‘ignore’, propagate NaN values, without passing them to the mapping correspondence.    Returns
 Series

Same index as caller.      See also  Series.apply

For applying more complex functions on a Series.  DataFrame.apply

Apply a function row-/column-wise.  DataFrame.applymap

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
>>> s = pd.Series(['cat', 'dog', np.nan, 'rabbit'])
>>> s
0      cat
1      dog
2      NaN
3   rabbit
dtype: object
  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):
>>> s.map({'cat': 'kitten', 'dog': 'puppy'})
0   kitten
1    puppy
2      NaN
3      NaN
dtype: object
  It also accepts a function:
>>> s.map('I am a {}'.format)
0       I am a cat
1       I am a dog
2       I am a nan
3    I am a rabbit
dtype: object
  To avoid applying the function to missing values (and keep them as NaN) na_action='ignore' can be used:
>>> s.map('I am a {}'.format, na_action='ignore')
0     I am a cat
1     I am a dog
2            NaN
3  I am a rabbit
dtype: object


pandas.Series.mask   Series.mask(cond, other=nan, inplace=False, axis=None, level=None, errors=NoDefault.no_default, try_cast=NoDefault.no_default)[source]

Replace values where the condition is True.  Parameters

cond:bool Series/DataFrame, array-like, or callable

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).
other:scalar, Series/DataFrame, or callable

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).
inplace:bool, default False

Whether to perform the operation in place on the data.
axis:int, default None

Alignment axis if needed.
level:int, default None

Alignment level if needed.
errors:str, {‘raise’, ‘ignore’}, default ‘raise’

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_cast:bool, default None

Try to cast the result back to the input type (if possible).  Deprecated since version 1.3.0: Manually cast back if necessary.     Returns
 Same type as caller or None if inplace=True.
    See also  DataFrame.where()

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
>>> s = pd.Series(range(5))
>>> s.where(s > 0)
0    NaN
1    1.0
2    2.0
3    3.0
4    4.0
dtype: float64
>>> s.mask(s > 0)
0    0.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64

>>> s.where(s > 1, 10)
0    10
1    10
2    2
3    3
4    4
dtype: int64
>>> s.mask(s > 1, 10)
0     0
1     1
2    10
3    10
4    10
dtype: int64

>>> df = pd.DataFrame(np.arange(10).reshape(-1, 2), columns=['A', 'B'])
>>> df
   A  B
0  0  1
1  2  3
2  4  5
3  6  7
4  8  9
>>> m = df % 3 == 0
>>> df.where(m, -df)
   A  B
0  0 -1
1 -2  3
2 -4 -5
3  6 -7
4 -8  9
>>> df.where(m, -df) == np.where(m, df, -df)
      A     B
0  True  True
1  True  True
2  True  True
3  True  True
4  True  True
>>> df.where(m, -df) == df.mask(~m, -df)
      A     B
0  True  True
1  True  True
2  True  True
3  True  True
4  True  True


pandas.Series.max   Series.max(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]

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.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples
>>> idx = pd.MultiIndex.from_arrays([
...     ['warm', 'warm', 'cold', 'cold'],
...     ['dog', 'falcon', 'fish', 'spider']],
...     names=['blooded', 'animal'])
>>> s = pd.Series([4, 2, 0, 8], name='legs', index=idx)
>>> s
blooded  animal
warm     dog       4
         falcon    2
cold     fish      0
         spider    8
Name: legs, dtype: int64

>>> s.max()
8


pandas.Series.mean   Series.mean(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]

Return the mean of the values over the requested axis.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)


pandas.Series.median   Series.median(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]

Return the median of the values over the requested axis.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)


pandas.Series.memory_usage   Series.memory_usage(index=True, deep=False)[source]

Return the memory usage of the Series. The memory usage can optionally include the contribution of the index and of elements of object dtype.  Parameters

index:bool, default True

Specifies whether to include the memory usage of the Series index.
deep:bool, default False

If True, introspect the data deeply by interrogating object dtypes for system-level memory consumption, and include it in the returned value.    Returns
 int

Bytes of memory consumed.      See also  numpy.ndarray.nbytes

Total bytes consumed by the elements of the array.  DataFrame.memory_usage

Bytes consumed by a DataFrame.    Examples
>>> s = pd.Series(range(3))
>>> s.memory_usage()
152
  Not including the index gives the size of the rest of the data, which is necessarily smaller:
>>> s.memory_usage(index=False)
24
  The memory footprint of object values is ignored by default:
>>> s = pd.Series(["a", "b"])
>>> s.values
array(['a', 'b'], dtype=object)
>>> s.memory_usage()
144
>>> s.memory_usage(deep=True)
244


pandas.Series.min   Series.min(axis=NoDefault.no_default, skipna=True, level=None, numeric_only=None, **kwargs)[source]

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.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples
>>> idx = pd.MultiIndex.from_arrays([
...     ['warm', 'warm', 'cold', 'cold'],
...     ['dog', 'falcon', 'fish', 'spider']],
...     names=['blooded', 'animal'])
>>> s = pd.Series([4, 2, 0, 8], name='legs', index=idx)
>>> s
blooded  animal
warm     dog       4
         falcon    2
cold     fish      0
         spider    8
Name: legs, dtype: int64

>>> s.min()
0


pandas.Series.mod   Series.mod(other, level=None, fill_value=None, axis=0)[source]

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.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.      See also  Series.rmod

Reverse of the Modulo operator, see Python documentation for more details.    Examples
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.mod(b, fill_value=0)
a    0.0
b    NaN
c    NaN
d    0.0
e    NaN
dtype: float64


pandas.Series.mode   Series.mode(dropna=True)[source]

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.  Parameters

dropna:bool, default True

Don’t consider counts of NaN/NaT.    Returns
 Series

Modes of the Series in sorted order.


pandas.Series.mul   Series.mul(other, level=None, fill_value=None, axis=0)[source]

Return Multiplication of series and other, element-wise (binary operator mul). Equivalent to series * other, but with support to substitute a fill_value for missing data in either one of the inputs.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.      See also  Series.rmul

Reverse of the Multiplication operator, see Python documentation for more details.    Examples
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.multiply(b, fill_value=0)
a    1.0
b    0.0
c    0.0
d    0.0
e    NaN
dtype: float64


pandas.Series.multiply   Series.multiply(other, level=None, fill_value=None, axis=0)[source]

Return Multiplication of series and other, element-wise (binary operator mul). Equivalent to series * other, but with support to substitute a fill_value for missing data in either one of the inputs.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.      See also  Series.rmul

Reverse of the Multiplication operator, see Python documentation for more details.    Examples
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.multiply(b, fill_value=0)
a    1.0
b    0.0
c    0.0
d    0.0
e    NaN
dtype: float64


pandas.Series.name   propertySeries.name

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.  Returns
 label (hashable object)

The name of the Series, also the column name if part of a DataFrame.      See also  Series.rename

Sets the Series name when given a scalar input.  Index.name

Corresponding Index property.    Examples The Series name can be set initially when calling the constructor.
>>> s = pd.Series([1, 2, 3], dtype=np.int64, name='Numbers')
>>> s
0    1
1    2
2    3
Name: Numbers, dtype: int64
>>> s.name = "Integers"
>>> s
0    1
1    2
2    3
Name: Integers, dtype: int64
  The name of a Series within a DataFrame is its column name.
>>> df = pd.DataFrame([[1, 2], [3, 4], [5, 6]],
...                   columns=["Odd Numbers", "Even Numbers"])
>>> df
   Odd Numbers  Even Numbers
0            1             2
1            3             4
2            5             6
>>> df["Even Numbers"].name
'Even Numbers'


pandas.Series.nbytes   propertySeries.nbytes

Return the number of bytes in the underlying data.


pandas.Series.ndim   propertySeries.ndim

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


pandas.Series.ne   Series.ne(other, level=None, fill_value=None, axis=0)[source]

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.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.     Examples
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.ne(b, fill_value=0)
a    False
b     True
c     True
d     True
e     True
dtype: bool


pandas.Series.nlargest   Series.nlargest(n=5, keep='first')[source]

Return the largest n elements.  Parameters

n:int, default 5

Return this many descending sorted values.
keep:{‘first’, ‘last’, ‘all’}, default ‘first’

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.     Returns
 Series

The n largest values in the Series, sorted in decreasing order.      See also  Series.nsmallest

Get the n smallest elements.  Series.sort_values

Sort Series by values.  Series.head

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
>>> countries_population = {"Italy": 59000000, "France": 65000000,
...                         "Malta": 434000, "Maldives": 434000,
...                         "Brunei": 434000, "Iceland": 337000,
...                         "Nauru": 11300, "Tuvalu": 11300,
...                         "Anguilla": 11300, "Montserrat": 5200}
>>> s = pd.Series(countries_population)
>>> s
Italy       59000000
France      65000000
Malta         434000
Maldives      434000
Brunei        434000
Iceland       337000
Nauru          11300
Tuvalu         11300
Anguilla       11300
Montserrat      5200
dtype: int64
  The n largest elements where n=5 by default.
>>> s.nlargest()
France      65000000
Italy       59000000
Malta         434000
Maldives      434000
Brunei        434000
dtype: int64
  The n largest elements where n=3. Default keep value is ‘first’ so Malta will be kept.
>>> s.nlargest(3)
France    65000000
Italy     59000000
Malta       434000
dtype: int64
  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.
>>> s.nlargest(3, keep='last')
France      65000000
Italy       59000000
Brunei        434000
dtype: int64
  The n largest elements where n=3 with all duplicates kept. Note that the returned Series has five elements due to the three duplicates.
>>> s.nlargest(3, keep='all')
France      65000000
Italy       59000000
Malta         434000
Maldives      434000
Brunei        434000
dtype: int64


pandas.Series.notna   Series.notna()[source]

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.  Returns
 Series

Mask of bool values for each element in Series that indicates whether an element is not an NA value.      See also  Series.notnull

Alias of notna.  Series.isna

Boolean inverse of notna.  Series.dropna

Omit axes labels with missing values.  notna

Top-level notna.    Examples Show which entries in a DataFrame are not NA.
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker

>>> df.notna()
     age   born  name    toy
0   True  False  True  False
1   True   True  True   True
2  False   True  True   True
  Show which entries in a Series are not NA.
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64

>>> ser.notna()
0     True
1     True
2    False
dtype: bool


pandas.Series.notnull   Series.notnull()[source]

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.  Returns
 Series

Mask of bool values for each element in Series that indicates whether an element is not an NA value.      See also  Series.notnull

Alias of notna.  Series.isna

Boolean inverse of notna.  Series.dropna

Omit axes labels with missing values.  notna

Top-level notna.    Examples Show which entries in a DataFrame are not NA.
>>> df = pd.DataFrame(dict(age=[5, 6, np.NaN],
...                    born=[pd.NaT, pd.Timestamp('1939-05-27'),
...                          pd.Timestamp('1940-04-25')],
...                    name=['Alfred', 'Batman', ''],
...                    toy=[None, 'Batmobile', 'Joker']))
>>> df
   age       born    name        toy
0  5.0        NaT  Alfred       None
1  6.0 1939-05-27  Batman  Batmobile
2  NaN 1940-04-25              Joker

>>> df.notna()
     age   born  name    toy
0   True  False  True  False
1   True   True  True   True
2  False   True  True   True
  Show which entries in a Series are not NA.
>>> ser = pd.Series([5, 6, np.NaN])
>>> ser
0    5.0
1    6.0
2    NaN
dtype: float64

>>> ser.notna()
0     True
1     True
2    False
dtype: bool


pandas.Series.nsmallest   Series.nsmallest(n=5, keep='first')[source]

Return the smallest n elements.  Parameters

n:int, default 5

Return this many ascending sorted values.
keep:{‘first’, ‘last’, ‘all’}, default ‘first’

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.     Returns
 Series

The n smallest values in the Series, sorted in increasing order.      See also  Series.nlargest

Get the n largest elements.  Series.sort_values

Sort Series by values.  Series.head

Return the first n rows.    Notes Faster than .sort_values().head(n) for small n relative to the size of the Series object. Examples
>>> countries_population = {"Italy": 59000000, "France": 65000000,
...                         "Brunei": 434000, "Malta": 434000,
...                         "Maldives": 434000, "Iceland": 337000,
...                         "Nauru": 11300, "Tuvalu": 11300,
...                         "Anguilla": 11300, "Montserrat": 5200}
>>> s = pd.Series(countries_population)
>>> s
Italy       59000000
France      65000000
Brunei        434000
Malta         434000
Maldives      434000
Iceland       337000
Nauru          11300
Tuvalu         11300
Anguilla       11300
Montserrat      5200
dtype: int64
  The n smallest elements where n=5 by default.
>>> s.nsmallest()
Montserrat    5200
Nauru        11300
Tuvalu       11300
Anguilla     11300
Iceland     337000
dtype: int64
  The n smallest elements where n=3. Default keep value is ‘first’ so Nauru and Tuvalu will be kept.
>>> s.nsmallest(3)
Montserrat   5200
Nauru       11300
Tuvalu      11300
dtype: int64
  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.
>>> s.nsmallest(3, keep='last')
Montserrat   5200
Anguilla    11300
Tuvalu      11300
dtype: int64
  The n smallest elements where n=3 with all duplicates kept. Note that the returned Series has four elements due to the three duplicates.
>>> s.nsmallest(3, keep='all')
Montserrat   5200
Nauru       11300
Tuvalu      11300
Anguilla    11300
dtype: int64


pandas.Series.nunique   Series.nunique(dropna=True)[source]

Return number of unique elements in the object. Excludes NA values by default.  Parameters

dropna:bool, default True

Don’t include NaN in the count.    Returns
 int
    See also  DataFrame.nunique

Method nunique for DataFrame.  Series.count

Count non-NA/null observations in the Series.    Examples
>>> s = pd.Series([1, 3, 5, 7, 7])
>>> s
0    1
1    3
2    5
3    7
4    7
dtype: int64

>>> s.nunique()
4


pandas.Series.pad   Series.pad(axis=None, inplace=False, limit=None, downcast=None)[source]

Synonym for DataFrame.fillna() with method='ffill'.  Returns
 Series/DataFrame or None

Object with missing values filled or None if inplace=True.


pandas.Series.pct_change   Series.pct_change(periods=1, fill_method='pad', limit=None, freq=None, **kwargs)[source]

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.  Parameters

periods:int, default 1

Periods to shift for forming percent change.
fill_method:str, default ‘pad’

How to handle NAs before computing percent changes.
limit:int, default None

The number of consecutive NAs to fill before stopping.
freq:DateOffset, timedelta, or str, optional

Increment to use from time series API (e.g. ‘M’ or BDay()).  **kwargs

Additional keyword arguments are passed into DataFrame.shift or Series.shift.    Returns

chg:Series or DataFrame

The same type as the calling object.      See also  Series.diff

Compute the difference of two elements in a Series.  DataFrame.diff

Compute the difference of two elements in a DataFrame.  Series.shift

Shift the index by some number of periods.  DataFrame.shift

Shift the index by some number of periods.    Examples Series
>>> s = pd.Series([90, 91, 85])
>>> s
0    90
1    91
2    85
dtype: int64

>>> s.pct_change()
0         NaN
1    0.011111
2   -0.065934
dtype: float64

>>> s.pct_change(periods=2)
0         NaN
1         NaN
2   -0.055556
dtype: float64
  See the percentage change in a Series where filling NAs with last valid observation forward to next valid.
>>> s = pd.Series([90, 91, None, 85])
>>> s
0    90.0
1    91.0
2     NaN
3    85.0
dtype: float64

>>> s.pct_change(fill_method='ffill')
0         NaN
1    0.011111
2    0.000000
3   -0.065934
dtype: float64
  DataFrame Percentage change in French franc, Deutsche Mark, and Italian lira from 1980-01-01 to 1980-03-01.
>>> df = pd.DataFrame({
...     'FR': [4.0405, 4.0963, 4.3149],
...     'GR': [1.7246, 1.7482, 1.8519],
...     'IT': [804.74, 810.01, 860.13]},
...     index=['1980-01-01', '1980-02-01', '1980-03-01'])
>>> df
                FR      GR      IT
1980-01-01  4.0405  1.7246  804.74
1980-02-01  4.0963  1.7482  810.01
1980-03-01  4.3149  1.8519  860.13

>>> df.pct_change()
                  FR        GR        IT
1980-01-01       NaN       NaN       NaN
1980-02-01  0.013810  0.013684  0.006549
1980-03-01  0.053365  0.059318  0.061876
  Percentage of change in GOOG and APPL stock volume. Shows computing the percentage change between columns.
>>> df = pd.DataFrame({
...     '2016': [1769950, 30586265],
...     '2015': [1500923, 40912316],
...     '2014': [1371819, 41403351]},
...     index=['GOOG', 'APPL'])
>>> df
          2016      2015      2014
GOOG   1769950   1500923   1371819
APPL  30586265  40912316  41403351

>>> df.pct_change(axis='columns', periods=-1)
          2016      2015  2014
GOOG  0.179241  0.094112   NaN
APPL -0.252395 -0.011860   NaN


pandas.Series.pipe   Series.pipe(func, *args, **kwargs)[source]

Apply chainable functions that expect Series or DataFrames.  Parameters

func:function

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.
args:iterable, optional

Positional arguments passed into func.
kwargs:mapping, optional

A dictionary of keyword arguments passed into func.    Returns

object:the return type of func.

    See also  DataFrame.apply

Apply a function along input axis of DataFrame.  DataFrame.applymap

Apply a function elementwise on a whole DataFrame.  Series.map

Apply a mapping correspondence on a Series.    Notes Use .pipe when chaining together functions that expect Series, DataFrames or GroupBy objects. Instead of writing
>>> func(g(h(df), arg1=a), arg2=b, arg3=c)
  You can write
>>> (df.pipe(h)
...    .pipe(g, arg1=a)
...    .pipe(func, arg2=b, arg3=c)
... )
  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:
>>> (df.pipe(h)
...    .pipe(g, arg1=a)
...    .pipe((func, 'arg2'), arg1=a, arg3=c)
...  )


pandas.Series.plot   Series.plot(*args, **kwargs)[source]

Make plots of Series or DataFrame. Uses the backend specified by the option plotting.backend. By default, matplotlib is used.  Parameters

data:Series or DataFrame

The object for which the method is called.
x:label or position, default None

Only used if data is a DataFrame.
y:label, position or list of label, positions, default None

Allows plotting of one column versus another. Only used if data is a DataFrame.
kind:str

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)
ax:matplotlib axes object, default None

An axes of the current figure.
subplots:bool, default False

Make separate subplots for each column.
sharex:bool, default True if ax is None else False

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.
sharey:bool, default False

In case subplots=True, share y axis and set some y axis labels to invisible.
layout:tuple, optional

(rows, columns) for the layout of subplots.
figsize:a tuple (width, height) in inches

Size of a figure object.
use_index:bool, default True

Use index as ticks for x axis.
title:str or list

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.
grid:bool, default None (matlab style default)

Axis grid lines.
legend:bool or {‘reverse’}

Place legend on axis subplots.
style:list or dict

The matplotlib line style per column.
logx:bool or ‘sym’, default False

Use log scaling or symlog scaling on x axis. .. versionchanged:: 0.25.0
logy:bool or ‘sym’ default False

Use log scaling or symlog scaling on y axis. .. versionchanged:: 0.25.0
loglog:bool or ‘sym’, default False

Use log scaling or symlog scaling on both x and y axes. .. versionchanged:: 0.25.0
xticks:sequence

Values to use for the xticks.
yticks:sequence

Values to use for the yticks.
xlim:2-tuple/list

Set the x limits of the current axes.
ylim:2-tuple/list

Set the y limits of the current axes.
xlabel:label, optional

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).
ylabel:label, optional

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).
rot:int, default None

Rotation for ticks (xticks for vertical, yticks for horizontal plots).
fontsize:int, default None

Font size for xticks and yticks.
colormap:str or matplotlib colormap object, default None

Colormap to select colors from. If string, load colormap with that name from matplotlib.
colorbar:bool, optional

If True, plot colorbar (only relevant for ‘scatter’ and ‘hexbin’ plots).
position:float

Specify relative alignments for bar plot layout. From 0 (left/bottom-end) to 1 (right/top-end). Default is 0.5 (center).
table:bool, Series or DataFrame, default False

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.
yerr:DataFrame, Series, array-like, dict and str

See Plotting with Error Bars for detail.
xerr:DataFrame, Series, array-like, dict and str

Equivalent to yerr.
stacked:bool, default False in line and bar plots, and True in area plot

If True, create stacked plot.
sort_columns:bool, default False

Sort column names to determine plot ordering.
secondary_y:bool or sequence, default False

Whether to plot on the secondary y-axis if a list/tuple, which columns to plot on secondary y-axis.
mark_right:bool, default True

When using a secondary_y axis, automatically mark the column labels with “(right)” in the legend.
include_bool:bool, default is False

If True, boolean values can be plotted.
backend:str, default None

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.   **kwargs

Options to pass to matplotlib plotting method.    Returns

matplotlib.axes.Axes or numpy.ndarray of them

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)


pandas.Series.plot.area   Series.plot.area(x=None, y=None, **kwargs)[source]

Draw a stacked area plot. An area plot displays quantitative data visually. This function wraps the matplotlib area function.  Parameters

x:label or position, optional

Coordinates for the X axis. By default uses the index.
y:label or position, optional

Column to plot. By default uses all columns.
stacked:bool, default True

Area plots are stacked by default. Set to False to create a unstacked plot.  **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns
 matplotlib.axes.Axes or numpy.ndarray

Area plot, or array of area plots if subplots is True.      See also  DataFrame.plot

Make plots of DataFrame using matplotlib / pylab.    Examples Draw an area plot based on basic business metrics:
>>> df = pd.DataFrame({
...     'sales': [3, 2, 3, 9, 10, 6],
...     'signups': [5, 5, 6, 12, 14, 13],
...     'visits': [20, 42, 28, 62, 81, 50],
... }, index=pd.date_range(start='2018/01/01', end='2018/07/01',
...                        freq='M'))
>>> ax = df.plot.area()
     Area plots are stacked by default. To produce an unstacked plot, pass stacked=False:
>>> ax = df.plot.area(stacked=False)
     Draw an area plot for a single column:
>>> ax = df.plot.area(y='sales')
     Draw with a different x:
>>> df = pd.DataFrame({
...     'sales': [3, 2, 3],
...     'visits': [20, 42, 28],
...     'day': [1, 2, 3],
... })
>>> ax = df.plot.area(x='day')


pandas.Series.plot.bar   Series.plot.bar(x=None, y=None, **kwargs)[source]

Vertical bar plot. A bar plot is a plot that presents categorical data with rectangular bars with lengths proportional to the values that they represent. A bar plot shows comparisons among discrete categories. One axis of the plot shows the specific categories being compared, and the other axis represents a measured value.  Parameters

x:label or position, optional

Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
y:label or position, optional

Allows plotting of one column versus another. If not specified, all numerical columns are used.
color:str, array-like, or dict, optional

The color for each of the DataFrame’s columns. Possible values are:
 A single color string referred to by name, RGB or RGBA code,

for instance ‘red’ or ‘#a98d19’.
 A sequence of color strings referred to by name, RGB or RGBA

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.
 A dict of the form {column name:color}, so that each column will be

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.   **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns
 matplotlib.axes.Axes or np.ndarray of them

An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.      See also  DataFrame.plot.barh

Horizontal bar plot.  DataFrame.plot

Make plots of a DataFrame.  matplotlib.pyplot.bar

Make a bar plot with matplotlib.    Examples Basic plot.
>>> df = pd.DataFrame({'lab':['A', 'B', 'C'], 'val':[10, 30, 20]})
>>> ax = df.plot.bar(x='lab', y='val', rot=0)
     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.
>>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
>>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
>>> index = ['snail', 'pig', 'elephant',
...          'rabbit', 'giraffe', 'coyote', 'horse']
>>> df = pd.DataFrame({'speed': speed,
...                    'lifespan': lifespan}, index=index)
>>> ax = df.plot.bar(rot=0)
     Plot stacked bar charts for the DataFrame
>>> ax = df.plot.bar(stacked=True)
     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.
>>> axes = df.plot.bar(rot=0, subplots=True)
>>> axes[1].legend(loc=2)
     If you don’t like the default colours, you can specify how you’d like each column to be colored.
>>> axes = df.plot.bar(
...     rot=0, subplots=True, color={"speed": "red", "lifespan": "green"}
... )
>>> axes[1].legend(loc=2)
     Plot a single column.
>>> ax = df.plot.bar(y='speed', rot=0)
     Plot only selected categories for the DataFrame.
>>> ax = df.plot.bar(x='lifespan', rot=0)


pandas.Series.plot.barh   Series.plot.barh(x=None, y=None, **kwargs)[source]

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.  Parameters

x:label or position, optional

Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
y:label or position, optional

Allows plotting of one column versus another. If not specified, all numerical columns are used.
color:str, array-like, or dict, optional

The color for each of the DataFrame’s columns. Possible values are:
 A single color string referred to by name, RGB or RGBA code,

for instance ‘red’ or ‘#a98d19’.
 A sequence of color strings referred to by name, RGB or RGBA

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.
 A dict of the form {column name:color}, so that each column will be

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.   **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns
 matplotlib.axes.Axes or np.ndarray of them

An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.      See also  DataFrame.plot.bar

Vertical bar plot.  DataFrame.plot

Make plots of DataFrame using matplotlib.  matplotlib.axes.Axes.bar

Plot a vertical bar plot using matplotlib.    Examples Basic example
>>> df = pd.DataFrame({'lab': ['A', 'B', 'C'], 'val': [10, 30, 20]})
>>> ax = df.plot.barh(x='lab', y='val')
     Plot a whole DataFrame to a horizontal bar plot
>>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
>>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
>>> index = ['snail', 'pig', 'elephant',
...          'rabbit', 'giraffe', 'coyote', 'horse']
>>> df = pd.DataFrame({'speed': speed,
...                    'lifespan': lifespan}, index=index)
>>> ax = df.plot.barh()
     Plot stacked barh charts for the DataFrame
>>> ax = df.plot.barh(stacked=True)
     We can specify colors for each column
>>> ax = df.plot.barh(color={"speed": "red", "lifespan": "green"})
     Plot a column of the DataFrame to a horizontal bar plot
>>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
>>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
>>> index = ['snail', 'pig', 'elephant',
...          'rabbit', 'giraffe', 'coyote', 'horse']
>>> df = pd.DataFrame({'speed': speed,
...                    'lifespan': lifespan}, index=index)
>>> ax = df.plot.barh(y='speed')
     Plot DataFrame versus the desired column
>>> speed = [0.1, 17.5, 40, 48, 52, 69, 88]
>>> lifespan = [2, 8, 70, 1.5, 25, 12, 28]
>>> index = ['snail', 'pig', 'elephant',
...          'rabbit', 'giraffe', 'coyote', 'horse']
>>> df = pd.DataFrame({'speed': speed,
...                    'lifespan': lifespan}, index=index)
>>> ax = df.plot.barh(x='lifespan')


pandas.Series.plot.box   Series.plot.box(by=None, **kwargs)[source]

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.  Parameters

by:str or sequence

Column in the DataFrame to group by.  Changed in version 1.4.0: Previously, by is silently ignore and makes no groupings   **kwargs

Additional keywords are documented in DataFrame.plot().    Returns

matplotlib.axes.Axes or numpy.ndarray of them
    See also  DataFrame.boxplot

Another method to draw a box plot.  Series.plot.box

Draw a box plot from a Series object.  matplotlib.pyplot.boxplot

Draw a box plot in matplotlib.    Examples Draw a box plot from a DataFrame with four columns of randomly generated data.
>>> data = np.random.randn(25, 4)
>>> df = pd.DataFrame(data, columns=list('ABCD'))
>>> ax = df.plot.box()
     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.
>>> age_list = [8, 10, 12, 14, 72, 74, 76, 78, 20, 25, 30, 35, 60, 85]
>>> df = pd.DataFrame({"gender": list("MMMMMMMMFFFFFF"), "age": age_list})
>>> ax = df.plot.box(column="age", by="gender", figsize=(10, 8))


pandas.Series.plot.density   Series.plot.density(bw_method=None, ind=None, **kwargs)[source]

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.  Parameters

bw_method:str, scalar or callable, optional

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.
ind:NumPy array or int, optional

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.  **kwargs

Additional keyword arguments are documented in pandas.%(this-datatype)s.plot().    Returns
 matplotlib.axes.Axes or numpy.ndarray of them
    See also  scipy.stats.gaussian_kde

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):
>>> s = pd.Series([1, 2, 2.5, 3, 3.5, 4, 5])
>>> ax = s.plot.kde()
     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:
>>> ax = s.plot.kde(bw_method=0.3)

>>> ax = s.plot.kde(bw_method=3)
     Finally, the ind parameter determines the evaluation points for the plot of the estimated PDF:
>>> ax = s.plot.kde(ind=[1, 2, 3, 4, 5])
     For DataFrame, it works in the same way:
>>> df = pd.DataFrame({
...     'x': [1, 2, 2.5, 3, 3.5, 4, 5],
...     'y': [4, 4, 4.5, 5, 5.5, 6, 6],
... })
>>> ax = df.plot.kde()
     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:
>>> ax = df.plot.kde(bw_method=0.3)

>>> ax = df.plot.kde(bw_method=3)
     Finally, the ind parameter determines the evaluation points for the plot of the estimated PDF:
>>> ax = df.plot.kde(ind=[1, 2, 3, 4, 5, 6])


pandas.Series.plot.hist   Series.plot.hist(by=None, bins=10, **kwargs)[source]

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.  Parameters

by:str or sequence, optional

Column in the DataFrame to group by.  Changed in version 1.4.0: Previously, by is silently ignore and makes no groupings
bins:int, default 10

Number of histogram bins to be used.  **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns
 class:matplotlib.AxesSubplot

Return a histogram plot.      See also  DataFrame.hist

Draw histograms per DataFrame’s Series.  Series.hist

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.
>>> df = pd.DataFrame(
...     np.random.randint(1, 7, 6000),
...     columns = ['one'])
>>> df['two'] = df['one'] + np.random.randint(1, 7, 6000)
>>> ax = df.plot.hist(bins=12, alpha=0.5)
     A grouped histogram can be generated by providing the parameter by (which can be a column name, or a list of column names):
>>> age_list = [8, 10, 12, 14, 72, 74, 76, 78, 20, 25, 30, 35, 60, 85]
>>> df = pd.DataFrame({"gender": list("MMMMMMMMFFFFFF"), "age": age_list})
>>> ax = df.plot.hist(column=["age"], by="gender", figsize=(10, 8))


pandas.Series.plot.kde   Series.plot.kde(bw_method=None, ind=None, **kwargs)[source]

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.  Parameters

bw_method:str, scalar or callable, optional

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.
ind:NumPy array or int, optional

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.  **kwargs

Additional keyword arguments are documented in pandas.%(this-datatype)s.plot().    Returns
 matplotlib.axes.Axes or numpy.ndarray of them
    See also  scipy.stats.gaussian_kde

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):
>>> s = pd.Series([1, 2, 2.5, 3, 3.5, 4, 5])
>>> ax = s.plot.kde()
     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:
>>> ax = s.plot.kde(bw_method=0.3)

>>> ax = s.plot.kde(bw_method=3)
     Finally, the ind parameter determines the evaluation points for the plot of the estimated PDF:
>>> ax = s.plot.kde(ind=[1, 2, 3, 4, 5])
     For DataFrame, it works in the same way:
>>> df = pd.DataFrame({
...     'x': [1, 2, 2.5, 3, 3.5, 4, 5],
...     'y': [4, 4, 4.5, 5, 5.5, 6, 6],
... })
>>> ax = df.plot.kde()
     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:
>>> ax = df.plot.kde(bw_method=0.3)

>>> ax = df.plot.kde(bw_method=3)
     Finally, the ind parameter determines the evaluation points for the plot of the estimated PDF:
>>> ax = df.plot.kde(ind=[1, 2, 3, 4, 5, 6])


pandas.Series.plot.line   Series.plot.line(x=None, y=None, **kwargs)[source]

Plot Series or DataFrame as lines. This function is useful to plot lines using DataFrame’s values as coordinates.  Parameters

x:label or position, optional

Allows plotting of one column versus another. If not specified, the index of the DataFrame is used.
y:label or position, optional

Allows plotting of one column versus another. If not specified, all numerical columns are used.
color:str, array-like, or dict, optional

The color for each of the DataFrame’s columns. Possible values are:
 A single color string referred to by name, RGB or RGBA code,

for instance ‘red’ or ‘#a98d19’.
 A sequence of color strings referred to by name, RGB or RGBA

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.
 A dict of the form {column name:color}, so that each column will be

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.   **kwargs

Additional keyword arguments are documented in DataFrame.plot().    Returns
 matplotlib.axes.Axes or np.ndarray of them

An ndarray is returned with one matplotlib.axes.Axes per column when subplots=True.      See also  matplotlib.pyplot.plot

Plot y versus x as lines and/or markers.    Examples
>>> s = pd.Series([1, 3, 2])
>>> s.plot.line()
<AxesSubplot:ylabel='Density'>
     The following example shows the populations for some animals over the years.
>>> df = pd.DataFrame({
...    'pig': [20, 18, 489, 675, 1776],
...    'horse': [4, 25, 281, 600, 1900]
...    }, index=[1990, 1997, 2003, 2009, 2014])
>>> lines = df.plot.line()
     An example with subplots, so an array of axes is returned.
>>> axes = df.plot.line(subplots=True)
>>> type(axes)
<class 'numpy.ndarray'>
     Let’s repeat the same example, but specifying colors for each column (in this case, for each animal).
>>> axes = df.plot.line(
...     subplots=True, color={"pig": "pink", "horse": "#742802"}
... )
     The following example shows the relationship between both populations.
>>> lines = df.plot.line(x='pig', y='horse')


pandas.Series.plot.pie   Series.plot.pie(**kwargs)[source]

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.  Parameters

y:int or label, optional

Label or position of the column to plot. If not provided, subplots=True argument must be passed.  **kwargs

Keyword arguments to pass on to DataFrame.plot().    Returns
 matplotlib.axes.Axes or np.ndarray of them

A NumPy array is returned when subplots is True.      See also  Series.plot.pie

Generate a pie plot for a Series.  DataFrame.plot

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.
>>> df = pd.DataFrame({'mass': [0.330, 4.87 , 5.97],
...                    'radius': [2439.7, 6051.8, 6378.1]},
...                   index=['Mercury', 'Venus', 'Earth'])
>>> plot = df.plot.pie(y='mass', figsize=(5, 5))

>>> plot = df.plot.pie(subplots=True, figsize=(11, 6))


pandas.Series.pop   Series.pop(item)[source]

Return item and drops from series. Raise KeyError if not found.  Parameters

item:label

Index of the element that needs to be removed.    Returns
 Value that is popped from series.
   Examples
>>> ser = pd.Series([1,2,3])

>>> ser.pop(0)
1

>>> ser
1    2
2    3
dtype: int64


pandas.Series.pow   Series.pow(other, level=None, fill_value=None, axis=0)[source]

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.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.      See also  Series.rpow

Reverse of the Exponential power operator, see Python documentation for more details.    Examples
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.pow(b, fill_value=0)
a    1.0
b    1.0
c    1.0
d    0.0
e    NaN
dtype: float64


pandas.Series.prod   Series.prod(axis=None, skipna=True, level=None, numeric_only=None, min_count=0, **kwargs)[source]

Return the product of the values over the requested axis.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
min_count:int, default 0

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.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples By default, the product of an empty or all-NA Series is 1
>>> pd.Series([], dtype="float64").prod()
1.0
  This can be controlled with the min_count parameter
>>> pd.Series([], dtype="float64").prod(min_count=1)
nan
  Thanks to the skipna parameter, min_count handles all-NA and empty series identically.
>>> pd.Series([np.nan]).prod()
1.0

>>> pd.Series([np.nan]).prod(min_count=1)
nan


pandas.Series.product   Series.product(axis=None, skipna=True, level=None, numeric_only=None, min_count=0, **kwargs)[source]

Return the product of the values over the requested axis.  Parameters

axis:{index (0)}

Axis for the function to be applied on.
skipna:bool, default True

Exclude NA/null values when computing the result.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
numeric_only:bool, default None

Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for Series.
min_count:int, default 0

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.  **kwargs

Additional keyword arguments to be passed to the function.    Returns
 scalar or Series (if level specified)
    See also  Series.sum

Return the sum.  Series.min

Return the minimum.  Series.max

Return the maximum.  Series.idxmin

Return the index of the minimum.  Series.idxmax

Return the index of the maximum.  DataFrame.sum

Return the sum over the requested axis.  DataFrame.min

Return the minimum over the requested axis.  DataFrame.max

Return the maximum over the requested axis.  DataFrame.idxmin

Return the index of the minimum over the requested axis.  DataFrame.idxmax

Return the index of the maximum over the requested axis.    Examples By default, the product of an empty or all-NA Series is 1
>>> pd.Series([], dtype="float64").prod()
1.0
  This can be controlled with the min_count parameter
>>> pd.Series([], dtype="float64").prod(min_count=1)
nan
  Thanks to the skipna parameter, min_count handles all-NA and empty series identically.
>>> pd.Series([np.nan]).prod()
1.0

>>> pd.Series([np.nan]).prod(min_count=1)
nan


pandas.Series.quantile   Series.quantile(q=0.5, interpolation='linear')[source]

Return value at the given quantile.  Parameters

q:float or array-like, default 0.5 (50% quantile)

The quantile(s) to compute, which can lie in range: 0 <= q <= 1.
interpolation:{‘linear’, ‘lower’, ‘higher’, ‘midpoint’, ‘nearest’}

This optional parameter specifies 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.
    Returns
 float or Series

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  core.window.Rolling.quantile

Calculate the rolling quantile.  numpy.percentile

Returns the q-th percentile(s) of the array elements.    Examples
>>> s = pd.Series([1, 2, 3, 4])
>>> s.quantile(.5)
2.5
>>> s.quantile([.25, .5, .75])
0.25    1.75
0.50    2.50
0.75    3.25
dtype: float64


pandas.Series.radd   Series.radd(other, level=None, fill_value=None, axis=0)[source]

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.  Parameters

other:Series or scalar value

fill_value:None or float value, default None (NaN)

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.
level:int or name

Broadcast across a level, matching Index values on the passed MultiIndex level.    Returns
 Series

The result of the operation.      See also  Series.add

Element-wise Addition, see Python documentation for more details.    Examples
>>> a = pd.Series([1, 1, 1, np.nan], index=['a', 'b', 'c', 'd'])
>>> a
a    1.0
b    1.0
c    1.0
d    NaN
dtype: float64
>>> b = pd.Series([1, np.nan, 1, np.nan], index=['a', 'b', 'd', 'e'])
>>> b
a    1.0
b    NaN
d    1.0
e    NaN
dtype: float64
>>> a.add(b, fill_value=0)
a    2.0
b    1.0
c    1.0
d    1.0
e    NaN
dtype: float64


pandas.Series.rank   Series.rank(axis=0, method='average', numeric_only=NoDefault.no_default, na_option='keep', ascending=True, pct=False)[source]

Compute numerical data ranks (1 through n) along axis. By default, equal values are assigned a rank that is the average of the ranks of those values.  Parameters

axis:{0 or ‘index’, 1 or ‘columns’}, default 0

Index to direct ranking.
method:{‘average’, ‘min’, ‘max’, ‘first’, ‘dense’}, default ‘average’

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.
numeric_only:bool, optional

For DataFrame objects, rank only numeric columns if set to True.
na_option:{‘keep’, ‘top’, ‘bottom’}, default ‘keep’

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
ascending:bool, default True

Whether or not the elements should be ranked in ascending order.
pct:bool, default False

Whether or not to display the returned rankings in percentile form.    Returns
 same type as caller

Return a Series or DataFrame with data ranks as values.      See also  core.groupby.GroupBy.rank

Rank of values within each group.    Examples
>>> df = pd.DataFrame(data={'Animal': ['cat', 'penguin', 'dog',
...                                    'spider', 'snake'],
...                         'Number_legs': [4, 2, 4, 8, np.nan]})
>>> df
    Animal  Number_legs
0      cat          4.0
1  penguin          2.0
2      dog          4.0
3   spider          8.0
4    snake          NaN
  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.
>>> df['default_rank'] = df['Number_legs'].rank()
>>> df['max_rank'] = df['Number_legs'].rank(method='max')
>>> df['NA_bottom'] = df['Number_legs'].rank(na_option='bottom')
>>> df['pct_rank'] = df['Number_legs'].rank(pct=True)
>>> df
    Animal  Number_legs  default_rank  max_rank  NA_bottom  pct_rank
0      cat          4.0           2.5       3.0        2.5     0.625
1  penguin          2.0           1.0       1.0        1.0     0.250
2      dog          4.0           2.5       3.0        2.5     0.625
3   spider          8.0           4.0       4.0        4.0     1.000
4    snake          NaN           NaN       NaN        5.0       NaN


pandas.Series.ravel   Series.ravel(order='C')[source]

Return the flattened underlying data as an ndarray.  Returns
 numpy.ndarray or ndarray-like

Flattened data of the Series.      See also  numpy.ndarray.ravel

Return a flattened array.