pandas.Series.to_excel   Series.to_excel(excel_writer, sheet_name='Sheet1', na_rep='', float_format=None, columns=None, header=True, index=True, index_label=None, startrow=0, startcol=0, engine=None, merge_cells=True, encoding=None, inf_rep='inf', verbose=True, freeze_panes=None, storage_options=None)[source]

Write object to an Excel sheet. To write a single object to an Excel .xlsx file it is only necessary to specify a target file name. To write to multiple sheets it is necessary to create an ExcelWriter object with a target file name, and specify a sheet in the file to write to. Multiple sheets may be written to by specifying unique sheet_name. With all data written to the file it is necessary to save the changes. Note that creating an ExcelWriter object with a file name that already exists will result in the contents of the existing file being erased.  Parameters

excel_writer:path-like, file-like, or ExcelWriter object

File path or existing ExcelWriter.
sheet_name:str, default ‘Sheet1’

Name of sheet which will contain DataFrame.
na_rep:str, default ‘’

Missing data representation.
float_format:str, optional

Format string for floating point numbers. For example float_format="%.2f" will format 0.1234 to 0.12.
columns:sequence or list of str, optional

Columns to write.
header:bool or list of str, default True

Write out the column names. If a list of string is given it is assumed to be aliases for the column names.
index:bool, default True

Write row names (index).
index_label:str or sequence, optional

Column label for index column(s) if desired. If not specified, and header and index are True, then the index names are used. A sequence should be given if the DataFrame uses MultiIndex.
startrow:int, default 0

Upper left cell row to dump data frame.
startcol:int, default 0

Upper left cell column to dump data frame.
engine:str, optional

Write engine to use, ‘openpyxl’ or ‘xlsxwriter’. You can also set this via the options io.excel.xlsx.writer, io.excel.xls.writer, and io.excel.xlsm.writer.  Deprecated since version 1.2.0: As the xlwt package is no longer maintained, the xlwt engine will be removed in a future version of pandas.
merge_cells:bool, default True

Write MultiIndex and Hierarchical Rows as merged cells.
encoding:str, optional

Encoding of the resulting excel file. Only necessary for xlwt, other writers support unicode natively.
inf_rep:str, default ‘inf’

Representation for infinity (there is no native representation for infinity in Excel).
verbose:bool, default True

Display more information in the error logs.
freeze_panes:tuple of int (length 2), optional

Specifies the one-based bottommost row and rightmost column that is to be frozen.
storage_options:dict, optional

Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.  New in version 1.2.0.       See also  to_csv

Write DataFrame to a comma-separated values (csv) file.  ExcelWriter

Class for writing DataFrame objects into excel sheets.  read_excel

Read an Excel file into a pandas DataFrame.  read_csv

Read a comma-separated values (csv) file into DataFrame.    Notes For compatibility with to_csv(), to_excel serializes lists and dicts to strings before writing. Once a workbook has been saved it is not possible to write further data without rewriting the whole workbook. Examples Create, write to and save a workbook:
>>> df1 = pd.DataFrame([['a', 'b'], ['c', 'd']],
...                    index=['row 1', 'row 2'],
...                    columns=['col 1', 'col 2'])
>>> df1.to_excel("output.xlsx")
  To specify the sheet name:
>>> df1.to_excel("output.xlsx",
...              sheet_name='Sheet_name_1')
  If you wish to write to more than one sheet in the workbook, it is necessary to specify an ExcelWriter object:
>>> df2 = df1.copy()
>>> with pd.ExcelWriter('output.xlsx') as writer:
...     df1.to_excel(writer, sheet_name='Sheet_name_1')
...     df2.to_excel(writer, sheet_name='Sheet_name_2')
  ExcelWriter can also be used to append to an existing Excel file:
>>> with pd.ExcelWriter('output.xlsx',
...                     mode='a') as writer:
...     df.to_excel(writer, sheet_name='Sheet_name_3')
  To set the library that is used to write the Excel file, you can pass the engine keyword (the default engine is automatically chosen depending on the file extension):
>>> df1.to_excel('output1.xlsx', engine='xlsxwriter')


pandas.Series.to_frame   Series.to_frame(name=NoDefault.no_default)[source]

Convert Series to DataFrame.  Parameters

name:object, optional

The passed name should substitute for the series name (if it has one).    Returns
 DataFrame

DataFrame representation of Series.     Examples
>>> s = pd.Series(["a", "b", "c"],
...               name="vals")
>>> s.to_frame()
  vals
0    a
1    b
2    c


pandas.Series.to_hdf   Series.to_hdf(path_or_buf, key, mode='a', complevel=None, complib=None, append=False, format=None, index=True, min_itemsize=None, nan_rep=None, dropna=None, data_columns=None, errors='strict', encoding='UTF-8')[source]

Write the contained data to an HDF5 file using HDFStore. Hierarchical Data Format (HDF) is self-describing, allowing an application to interpret the structure and contents of a file with no outside information. One HDF file can hold a mix of related objects which can be accessed as a group or as individual objects. In order to add another DataFrame or Series to an existing HDF file please use append mode and a different a key.  Warning One can store a subclass of DataFrame or Series to HDF5, but the type of the subclass is lost upon storing.  For more information see the user guide.  Parameters

path_or_buf:str or pandas.HDFStore

File path or HDFStore object.
key:str

Identifier for the group in the store.
mode:{‘a’, ‘w’, ‘r+’}, default ‘a’

Mode to open file:  ‘w’: write, a new file is created (an existing file with the same name would be deleted). ‘a’: append, an existing file is opened for reading and writing, and if the file does not exist it is created. ‘r+’: similar to ‘a’, but the file must already exist.
complevel:{0-9}, default None

Specifies a compression level for data. A value of 0 or None disables compression.
complib:{‘zlib’, ‘lzo’, ‘bzip2’, ‘blosc’}, default ‘zlib’

Specifies the compression library to be used. As of v0.20.2 these additional compressors for Blosc are supported (default if no compressor specified: ‘blosc:blosclz’): {‘blosc:blosclz’, ‘blosc:lz4’, ‘blosc:lz4hc’, ‘blosc:snappy’, ‘blosc:zlib’, ‘blosc:zstd’}. Specifying a compression library which is not available issues a ValueError.
append:bool, default False

For Table formats, append the input data to the existing.
format:{‘fixed’, ‘table’, None}, default ‘fixed’

Possible values:  ‘fixed’: Fixed format. Fast writing/reading. Not-appendable, nor searchable. ‘table’: Table format. Write as a PyTables Table structure which may perform worse but allow more flexible operations like searching / selecting subsets of the data. If None, pd.get_option(‘io.hdf.default_format’) is checked, followed by fallback to “fixed”.
errors:str, default ‘strict’

Specifies how encoding and decoding errors are to be handled. See the errors argument for open() for a full list of options.
encoding:str, default “UTF-8”

min_itemsize:dict or int, optional

Map column names to minimum string sizes for columns.
nan_rep:Any, optional

How to represent null values as str. Not allowed with append=True.
data_columns:list of columns or True, optional

List of columns to create as indexed data columns for on-disk queries, or True to use all columns. By default only the axes of the object are indexed. See Query via data columns. Applicable only to format=’table’.      See also  read_hdf

Read from HDF file.  DataFrame.to_parquet

Write a DataFrame to the binary parquet format.  DataFrame.to_sql

Write to a SQL table.  DataFrame.to_feather

Write out feather-format for DataFrames.  DataFrame.to_csv

Write out to a csv file.    Examples
>>> df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]},
...                   index=['a', 'b', 'c'])
>>> df.to_hdf('data.h5', key='df', mode='w')
  We can add another object to the same file:
>>> s = pd.Series([1, 2, 3, 4])
>>> s.to_hdf('data.h5', key='s')
  Reading from HDF file:
>>> pd.read_hdf('data.h5', 'df')
A  B
a  1  4
b  2  5
c  3  6
>>> pd.read_hdf('data.h5', 's')
0    1
1    2
2    3
3    4
dtype: int64


pandas.Series.to_json   Series.to_json(path_or_buf=None, orient=None, date_format=None, double_precision=10, force_ascii=True, date_unit='ms', default_handler=None, lines=False, compression='infer', index=True, indent=None, storage_options=None)[source]

Convert the object to a JSON string. Note NaN’s and None will be converted to null and datetime objects will be converted to UNIX timestamps.  Parameters

path_or_buf:str, path object, file-like object, or None, default None

String, path object (implementing os.PathLike[str]), or file-like object implementing a write() function. If None, the result is returned as a string.
orient:str

Indication of expected JSON string format.
Series:
 default is ‘index’ allowed values are: {‘split’, ‘records’, ‘index’, ‘table’}.

DataFrame:
 default is ‘columns’ allowed values are: {‘split’, ‘records’, ‘index’, ‘columns’, ‘values’, ‘table’}.

The format of the JSON string:
 ‘split’ : dict like {‘index’ -> [index], ‘columns’ -> [columns], ‘data’ -> [values]} ‘records’ : list like [{column -> value}, … , {column -> value}] ‘index’ : dict like {index -> {column -> value}} ‘columns’ : dict like {column -> {index -> value}} ‘values’ : just the values array ‘table’ : dict like {‘schema’: {schema}, ‘data’: {data}}  Describing the data, where data component is like orient='records'.

date_format:{None, ‘epoch’, ‘iso’}

Type of date conversion. ‘epoch’ = epoch milliseconds, ‘iso’ = ISO8601. The default depends on the orient. For orient='table', the default is ‘iso’. For all other orients, the default is ‘epoch’.
double_precision:int, default 10

The number of decimal places to use when encoding floating point values.
force_ascii:bool, default True

Force encoded string to be ASCII.
date_unit:str, default ‘ms’ (milliseconds)

The time unit to encode to, governs timestamp and ISO8601 precision. One of ‘s’, ‘ms’, ‘us’, ‘ns’ for second, millisecond, microsecond, and nanosecond respectively.
default_handler:callable, default None

Handler to call if object cannot otherwise be converted to a suitable format for JSON. Should receive a single argument which is the object to convert and return a serialisable object.
lines:bool, default False

If ‘orient’ is ‘records’ write out line-delimited json format. Will throw ValueError if incorrect ‘orient’ since others are not list-like.
compression:str or dict, default ‘infer’

For on-the-fly compression of the output data. If ‘infer’ and ‘path_or_buf’ path-like, then detect compression from the following extensions: ‘.gz’, ‘.bz2’, ‘.zip’, ‘.xz’, or ‘.zst’ (otherwise no compression). Set to None for no compression. Can also be a dict with key 'method' set to one of {'zip', 'gzip', 'bz2', 'zstd'} and other key-value pairs are forwarded to zipfile.ZipFile, gzip.GzipFile, bz2.BZ2File, or zstandard.ZstdDecompressor, respectively. As an example, the following could be passed for faster compression and to create a reproducible gzip archive: compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}.  Changed in version 1.4.0: Zstandard support.
index:bool, default True

Whether to include the index values in the JSON string. Not including the index (index=False) is only supported when orient is ‘split’ or ‘table’.
indent:int, optional

Length of whitespace used to indent each record.  New in version 1.0.0.
storage_options:dict, optional

Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.  New in version 1.2.0.     Returns
 None or str

If path_or_buf is None, returns the resulting json format as a string. Otherwise returns None.      See also  read_json

Convert a JSON string to pandas object.    Notes The behavior of indent=0 varies from the stdlib, which does not indent the output but does insert newlines. Currently, indent=0 and the default indent=None are equivalent in pandas, though this may change in a future release. orient='table' contains a ‘pandas_version’ field under ‘schema’. This stores the version of pandas used in the latest revision of the schema. Examples
>>> import json
>>> df = pd.DataFrame(
...     [["a", "b"], ["c", "d"]],
...     index=["row 1", "row 2"],
...     columns=["col 1", "col 2"],
... )

>>> result = df.to_json(orient="split")
>>> parsed = json.loads(result)
>>> json.dumps(parsed, indent=4)
{
    "columns": [
        "col 1",
        "col 2"
    ],
    "index": [
        "row 1",
        "row 2"
    ],
    "data": [
        [
            "a",
            "b"
        ],
        [
            "c",
            "d"
        ]
    ]
}
  Encoding/decoding a Dataframe using 'records' formatted JSON. Note that index labels are not preserved with this encoding.
>>> result = df.to_json(orient="records")
>>> parsed = json.loads(result)
>>> json.dumps(parsed, indent=4)
[
    {
        "col 1": "a",
        "col 2": "b"
    },
    {
        "col 1": "c",
        "col 2": "d"
    }
]
  Encoding/decoding a Dataframe using 'index' formatted JSON:
>>> result = df.to_json(orient="index")
>>> parsed = json.loads(result)
>>> json.dumps(parsed, indent=4)
{
    "row 1": {
        "col 1": "a",
        "col 2": "b"
    },
    "row 2": {
        "col 1": "c",
        "col 2": "d"
    }
}
  Encoding/decoding a Dataframe using 'columns' formatted JSON:
>>> result = df.to_json(orient="columns")
>>> parsed = json.loads(result)
>>> json.dumps(parsed, indent=4)
{
    "col 1": {
        "row 1": "a",
        "row 2": "c"
    },
    "col 2": {
        "row 1": "b",
        "row 2": "d"
    }
}
  Encoding/decoding a Dataframe using 'values' formatted JSON:
>>> result = df.to_json(orient="values")
>>> parsed = json.loads(result)
>>> json.dumps(parsed, indent=4)
[
    [
        "a",
        "b"
    ],
    [
        "c",
        "d"
    ]
]
  Encoding with Table Schema:
>>> result = df.to_json(orient="table")
>>> parsed = json.loads(result)
>>> json.dumps(parsed, indent=4)
{
    "schema": {
        "fields": [
            {
                "name": "index",
                "type": "string"
            },
            {
                "name": "col 1",
                "type": "string"
            },
            {
                "name": "col 2",
                "type": "string"
            }
        ],
        "primaryKey": [
            "index"
        ],
        "pandas_version": "1.4.0"
    },
    "data": [
        {
            "index": "row 1",
            "col 1": "a",
            "col 2": "b"
        },
        {
            "index": "row 2",
            "col 1": "c",
            "col 2": "d"
        }
    ]
}


pandas.Series.to_latex   Series.to_latex(buf=None, columns=None, col_space=None, header=True, index=True, na_rep='NaN', formatters=None, float_format=None, sparsify=None, index_names=True, bold_rows=False, column_format=None, longtable=None, escape=None, encoding=None, decimal='.', multicolumn=None, multicolumn_format=None, multirow=None, caption=None, label=None, position=None)[source]

Render object to a LaTeX tabular, longtable, or nested table. Requires \usepackage{booktabs}. The output can be copy/pasted into a main LaTeX document or read from an external file with \input{table.tex}.  Changed in version 1.0.0: Added caption and label arguments.   Changed in version 1.2.0: Added position argument, changed meaning of caption argument.   Parameters

buf:str, Path or StringIO-like, optional, default None

Buffer to write to. If None, the output is returned as a string.
columns:list of label, optional

The subset of columns to write. Writes all columns by default.
col_space:int, optional

The minimum width of each column.
header:bool or list of str, default True

Write out the column names. If a list of strings is given, it is assumed to be aliases for the column names.
index:bool, default True

Write row names (index).
na_rep:str, default ‘NaN’

Missing data representation.
formatters:list of functions or dict of {str: function}, optional

Formatter functions to apply to columns’ elements by position or name. The result of each function must be a unicode string. List must be of length equal to the number of columns.
float_format:one-parameter function or str, optional, default None

Formatter for floating point numbers. For example float_format="%.2f" and float_format="{:0.2f}".format will both result in 0.1234 being formatted as 0.12.
sparsify:bool, optional

Set to False for a DataFrame with a hierarchical index to print every multiindex key at each row. By default, the value will be read from the config module.
index_names:bool, default True

Prints the names of the indexes.
bold_rows:bool, default False

Make the row labels bold in the output.
column_format:str, optional

The columns format as specified in LaTeX table format e.g. ‘rcl’ for 3 columns. By default, ‘l’ will be used for all columns except columns of numbers, which default to ‘r’.
longtable:bool, optional

By default, the value will be read from the pandas config module. Use a longtable environment instead of tabular. Requires adding a usepackage{longtable} to your LaTeX preamble.
escape:bool, optional

By default, the value will be read from the pandas config module. When set to False prevents from escaping latex special characters in column names.
encoding:str, optional

A string representing the encoding to use in the output file, defaults to ‘utf-8’.
decimal:str, default ‘.’

Character recognized as decimal separator, e.g. ‘,’ in Europe.
multicolumn:bool, default True

Use multicolumn to enhance MultiIndex columns. The default will be read from the config module.
multicolumn_format:str, default ‘l’

The alignment for multicolumns, similar to column_format The default will be read from the config module.
multirow:bool, default False

Use multirow to enhance MultiIndex rows. Requires adding a usepackage{multirow} to your LaTeX preamble. Will print centered labels (instead of top-aligned) across the contained rows, separating groups via clines. The default will be read from the pandas config module.
caption:str or tuple, optional

Tuple (full_caption, short_caption), which results in \caption[short_caption]{full_caption}; if a single string is passed, no short caption will be set.  New in version 1.0.0.   Changed in version 1.2.0: Optionally allow caption to be a tuple (full_caption, short_caption).
label:str, optional

The LaTeX label to be placed inside \label{} in the output. This is used with \ref{} in the main .tex file.  New in version 1.0.0.
position:str, optional

The LaTeX positional argument for tables, to be placed after \begin{} in the output.  New in version 1.2.0.     Returns
 str or None

If buf is None, returns the result as a string. Otherwise returns None.      See also  Styler.to_latex

Render a DataFrame to LaTeX with conditional formatting.  DataFrame.to_string

Render a DataFrame to a console-friendly tabular output.  DataFrame.to_html

Render a DataFrame as an HTML table.    Examples
>>> df = pd.DataFrame(dict(name=['Raphael', 'Donatello'],
...                   mask=['red', 'purple'],
...                   weapon=['sai', 'bo staff']))
>>> print(df.to_latex(index=False))
\begin{tabular}{lll}
 \toprule
       name &    mask &    weapon \\
 \midrule
    Raphael &     red &       sai \\
  Donatello &  purple &  bo staff \\
\bottomrule
\end{tabular}


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

Return a list of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period)  Returns
 list
    See also  numpy.ndarray.tolist

Return the array as an a.ndim-levels deep nested list of Python scalars.


pandas.Series.to_markdown   Series.to_markdown(buf=None, mode='wt', index=True, storage_options=None, **kwargs)[source]

Print Series in Markdown-friendly format.  New in version 1.0.0.   Parameters

buf:str, Path or StringIO-like, optional, default None

Buffer to write to. If None, the output is returned as a string.
mode:str, optional

Mode in which file is opened, “wt” by default.
index:bool, optional, default True

Add index (row) labels.  New in version 1.1.0.
storage_options:dict, optional

Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.  New in version 1.2.0.   **kwargs

These parameters will be passed to tabulate.    Returns
 str

Series in Markdown-friendly format.     Notes Requires the tabulate package. Examples
>>> s = pd.Series(["elk", "pig", "dog", "quetzal"], name="animal")
>>> print(s.to_markdown())
|    | animal   |
|---:|:---------|
|  0 | elk      |
|  1 | pig      |
|  2 | dog      |
|  3 | quetzal  |
  Output markdown with a tabulate option.
>>> print(s.to_markdown(tablefmt="grid"))
+----+----------+
|    | animal   |
+====+==========+
|  0 | elk      |
+----+----------+
|  1 | pig      |
+----+----------+
|  2 | dog      |
+----+----------+
|  3 | quetzal  |
+----+----------+


pandas.Series.to_numpy   Series.to_numpy(dtype=None, copy=False, na_value=NoDefault.no_default, **kwargs)[source]

A NumPy ndarray representing the values in this Series or Index.  Parameters

dtype:str or numpy.dtype, optional

The dtype to pass to numpy.asarray().
copy:bool, default False

Whether to ensure that the returned value is not a view on another array. Note that copy=False does not ensure that to_numpy() is no-copy. Rather, copy=True ensure that a copy is made, even if not strictly necessary.
na_value:Any, optional

The value to use for missing values. The default value depends on dtype and the type of the array.  New in version 1.0.0.   **kwargs

Additional keywords passed through to the to_numpy method of the underlying array (for extension arrays).  New in version 1.0.0.     Returns
 numpy.ndarray
    See also  Series.array

Get the actual data stored within.  Index.array

Get the actual data stored within.  DataFrame.to_numpy

Similar method for DataFrame.    Notes The returned array will be the same up to equality (values equal in self will be equal in the returned array; likewise for values that are not equal). When self contains an ExtensionArray, the dtype may be different. For example, for a category-dtype Series, to_numpy() will return a NumPy array and the categorical dtype will be lost. For NumPy dtypes, this will be a reference to the actual data stored in this Series or Index (assuming copy=False). Modifying the result in place will modify the data stored in the Series or Index (not that we recommend doing that). For extension types, to_numpy() may require copying data and coercing the result to a NumPy type (possibly object), which may be expensive. When you need a no-copy reference to the underlying data, Series.array should be used instead. This table lays out the different dtypes and default return types of to_numpy() for various dtypes within pandas.
dtype array type
category[T] ndarray[T] (same dtype as input)
period ndarray[object] (Periods)
interval ndarray[object] (Intervals)
IntegerNA ndarray[object]
datetime64[ns] datetime64[ns]
datetime64[ns, tz] ndarray[object] (Timestamps)    Examples
>>> ser = pd.Series(pd.Categorical(['a', 'b', 'a']))
>>> ser.to_numpy()
array(['a', 'b', 'a'], dtype=object)
  Specify the dtype to control how datetime-aware data is represented. Use dtype=object to return an ndarray of pandas Timestamp objects, each with the correct tz.
>>> ser = pd.Series(pd.date_range('2000', periods=2, tz="CET"))
>>> ser.to_numpy(dtype=object)
array([Timestamp('2000-01-01 00:00:00+0100', tz='CET'),
       Timestamp('2000-01-02 00:00:00+0100', tz='CET')],
      dtype=object)
  Or dtype='datetime64[ns]' to return an ndarray of native datetime64 values. The values are converted to UTC and the timezone info is dropped.
>>> ser.to_numpy(dtype="datetime64[ns]")
...
array(['1999-12-31T23:00:00.000000000', '2000-01-01T23:00:00...'],
      dtype='datetime64[ns]')


pandas.Series.to_period   Series.to_period(freq=None, copy=True)[source]

Convert Series from DatetimeIndex to PeriodIndex.  Parameters

freq:str, default None

Frequency associated with the PeriodIndex.
copy:bool, default True

Whether or not to return a copy.    Returns
 Series

Series with index converted to PeriodIndex.


pandas.Series.to_pickle   Series.to_pickle(path, compression='infer', protocol=5, storage_options=None)[source]

Pickle (serialize) object to file.  Parameters

path:str

File path where the pickled object will be stored.
compression:str or dict, default ‘infer’

For on-the-fly compression of the output data. If ‘infer’ and ‘path’ path-like, then detect compression from the following extensions: ‘.gz’, ‘.bz2’, ‘.zip’, ‘.xz’, or ‘.zst’ (otherwise no compression). Set to None for no compression. Can also be a dict with key 'method' set to one of {'zip', 'gzip', 'bz2', 'zstd'} and other key-value pairs are forwarded to zipfile.ZipFile, gzip.GzipFile, bz2.BZ2File, or zstandard.ZstdDecompressor, respectively. As an example, the following could be passed for faster compression and to create a reproducible gzip archive: compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1}.
protocol:int

Int which indicates which protocol should be used by the pickler, default HIGHEST_PROTOCOL (see [1] paragraph 12.1.2). The possible values are 0, 1, 2, 3, 4, 5. A negative value for the protocol parameter is equivalent to setting its value to HIGHEST_PROTOCOL.  1
https://docs.python.org/3/library/pickle.html.
storage_options:dict, optional

Extra options that make sense for a particular storage connection, e.g. host, port, username, password, etc. For HTTP(S) URLs the key-value pairs are forwarded to urllib as header options. For other URLs (e.g. starting with “s3://”, and “gcs://”) the key-value pairs are forwarded to fsspec. Please see fsspec and urllib for more details.  New in version 1.2.0.       See also  read_pickle

Load pickled pandas object (or any object) from file.  DataFrame.to_hdf

Write DataFrame to an HDF5 file.  DataFrame.to_sql

Write DataFrame to a SQL database.  DataFrame.to_parquet

Write a DataFrame to the binary parquet format.    Examples
>>> original_df = pd.DataFrame({"foo": range(5), "bar": range(5, 10)})
>>> original_df
   foo  bar
0    0    5
1    1    6
2    2    7
3    3    8
4    4    9
>>> original_df.to_pickle("./dummy.pkl")

>>> unpickled_df = pd.read_pickle("./dummy.pkl")
>>> unpickled_df
   foo  bar
0    0    5
1    1    6
2    2    7
3    3    8
4    4    9


pandas.Series.to_sql   Series.to_sql(name, con, schema=None, if_exists='fail', index=True, index_label=None, chunksize=None, dtype=None, method=None)[source]

Write records stored in a DataFrame to a SQL database. Databases supported by SQLAlchemy [1] are supported. Tables can be newly created, appended to, or overwritten.  Parameters

name:str

Name of SQL table.
con:sqlalchemy.engine.(Engine or Connection) or sqlite3.Connection

Using SQLAlchemy makes it possible to use any DB supported by that library. Legacy support is provided for sqlite3.Connection objects. The user is responsible for engine disposal and connection closure for the SQLAlchemy connectable See here.
schema:str, optional

Specify the schema (if database flavor supports this). If None, use default schema.
if_exists:{‘fail’, ‘replace’, ‘append’}, default ‘fail’

How to behave if the table already exists.  fail: Raise a ValueError. replace: Drop the table before inserting new values. append: Insert new values to the existing table.
index:bool, default True

Write DataFrame index as a column. Uses index_label as the column name in the table.
index_label:str or sequence, default None

Column label for index column(s). If None is given (default) and index is True, then the index names are used. A sequence should be given if the DataFrame uses MultiIndex.
chunksize:int, optional

Specify the number of rows in each batch to be written at a time. By default, all rows will be written at once.
dtype:dict or scalar, optional

Specifying the datatype for columns. If a dictionary is used, the keys should be the column names and the values should be the SQLAlchemy types or strings for the sqlite3 legacy mode. If a scalar is provided, it will be applied to all columns.
method:{None, ‘multi’, callable}, optional

Controls the SQL insertion clause used:  None : Uses standard SQL INSERT clause (one per row). ‘multi’: Pass multiple values in a single INSERT clause. callable with signature (pd_table, conn, keys, data_iter).  Details and a sample callable implementation can be found in the section insert method.    Returns
 None or int

Number of rows affected by to_sql. None is returned if the callable passed into method does not return the number of rows. The number of returned rows affected is the sum of the rowcount attribute of sqlite3.Cursor or SQLAlchemy connectable which may not reflect the exact number of written rows as stipulated in the sqlite3 or SQLAlchemy.  New in version 1.4.0.     Raises
 ValueError

When the table already exists and if_exists is ‘fail’ (the default).      See also  read_sql

Read a DataFrame from a table.    Notes Timezone aware datetime columns will be written as Timestamp with timezone type with SQLAlchemy if supported by the database. Otherwise, the datetimes will be stored as timezone unaware timestamps local to the original timezone. References  1
https://docs.sqlalchemy.org  2
https://www.python.org/dev/peps/pep-0249/   Examples Create an in-memory SQLite database.
>>> from sqlalchemy import create_engine
>>> engine = create_engine('sqlite://', echo=False)
  Create a table from scratch with 3 rows.
>>> df = pd.DataFrame({'name' : ['User 1', 'User 2', 'User 3']})
>>> df
     name
0  User 1
1  User 2
2  User 3

>>> df.to_sql('users', con=engine)
3
>>> engine.execute("SELECT * FROM users").fetchall()
[(0, 'User 1'), (1, 'User 2'), (2, 'User 3')]
  An sqlalchemy.engine.Connection can also be passed to con:
>>> with engine.begin() as connection:
...     df1 = pd.DataFrame({'name' : ['User 4', 'User 5']})
...     df1.to_sql('users', con=connection, if_exists='append')
2
  This is allowed to support operations that require that the same DBAPI connection is used for the entire operation.
>>> df2 = pd.DataFrame({'name' : ['User 6', 'User 7']})
>>> df2.to_sql('users', con=engine, if_exists='append')
2
>>> engine.execute("SELECT * FROM users").fetchall()
[(0, 'User 1'), (1, 'User 2'), (2, 'User 3'),
 (0, 'User 4'), (1, 'User 5'), (0, 'User 6'),
 (1, 'User 7')]
  Overwrite the table with just df2.
>>> df2.to_sql('users', con=engine, if_exists='replace',
...            index_label='id')
2
>>> engine.execute("SELECT * FROM users").fetchall()
[(0, 'User 6'), (1, 'User 7')]
  Specify the dtype (especially useful for integers with missing values). Notice that while pandas is forced to store the data as floating point, the database supports nullable integers. When fetching the data with Python, we get back integer scalars.
>>> df = pd.DataFrame({"A": [1, None, 2]})
>>> df
     A
0  1.0
1  NaN
2  2.0

>>> from sqlalchemy.types import Integer
>>> df.to_sql('integers', con=engine, index=False,
...           dtype={"A": Integer()})
3

>>> engine.execute("SELECT * FROM integers").fetchall()
[(1,), (None,), (2,)]


pandas.Series.to_string   Series.to_string(buf=None, na_rep='NaN', float_format=None, header=True, index=True, length=False, dtype=False, name=False, max_rows=None, min_rows=None)[source]

Render a string representation of the Series.  Parameters

buf:StringIO-like, optional

Buffer to write to.
na_rep:str, optional

String representation of NaN to use, default ‘NaN’.
float_format:one-parameter function, optional

Formatter function to apply to columns’ elements if they are floats, default None.
header:bool, default True

Add the Series header (index name).
index:bool, optional

Add index (row) labels, default True.
length:bool, default False

Add the Series length.
dtype:bool, default False

Add the Series dtype.
name:bool, default False

Add the Series name if not None.
max_rows:int, optional

Maximum number of rows to show before truncating. If None, show all.
min_rows:int, optional

The number of rows to display in a truncated repr (when number of rows is above max_rows).    Returns
 str or None

String representation of Series if buf=None, otherwise None.


pandas.Series.to_timestamp   Series.to_timestamp(freq=None, how='start', copy=True)[source]

Cast to DatetimeIndex of Timestamps, at beginning of period.  Parameters

freq:str, default frequency of PeriodIndex

Desired frequency.
how:{‘s’, ‘e’, ‘start’, ‘end’}

Convention for converting period to timestamp; start of period vs. end.
copy:bool, default True

Whether or not to return a copy.    Returns
 Series with DatetimeIndex


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

Return an xarray object from the pandas object.  Returns
 xarray.DataArray or xarray.Dataset

Data in the pandas structure converted to Dataset if the object is a DataFrame, or a DataArray if the object is a Series.      See also  DataFrame.to_hdf

Write DataFrame to an HDF5 file.  DataFrame.to_parquet

Write a DataFrame to the binary parquet format.    Notes See the xarray docs Examples
>>> df = pd.DataFrame([('falcon', 'bird', 389.0, 2),
...                    ('parrot', 'bird', 24.0, 2),
...                    ('lion', 'mammal', 80.5, 4),
...                    ('monkey', 'mammal', np.nan, 4)],
...                   columns=['name', 'class', 'max_speed',
...                            'num_legs'])
>>> df
     name   class  max_speed  num_legs
0  falcon    bird      389.0         2
1  parrot    bird       24.0         2
2    lion  mammal       80.5         4
3  monkey  mammal        NaN         4

>>> df.to_xarray()
<xarray.Dataset>
Dimensions:    (index: 4)
Coordinates:
  * index      (index) int64 0 1 2 3
Data variables:
    name       (index) object 'falcon' 'parrot' 'lion' 'monkey'
    class      (index) object 'bird' 'bird' 'mammal' 'mammal'
    max_speed  (index) float64 389.0 24.0 80.5 nan
    num_legs   (index) int64 2 2 4 4

>>> df['max_speed'].to_xarray()
<xarray.DataArray 'max_speed' (index: 4)>
array([389. ,  24. ,  80.5,   nan])
Coordinates:
  * index    (index) int64 0 1 2 3

>>> dates = pd.to_datetime(['2018-01-01', '2018-01-01',
...                         '2018-01-02', '2018-01-02'])
>>> df_multiindex = pd.DataFrame({'date': dates,
...                               'animal': ['falcon', 'parrot',
...                                          'falcon', 'parrot'],
...                               'speed': [350, 18, 361, 15]})
>>> df_multiindex = df_multiindex.set_index(['date', 'animal'])

>>> df_multiindex
                   speed
date       animal
2018-01-01 falcon    350
           parrot     18
2018-01-02 falcon    361
           parrot     15

>>> df_multiindex.to_xarray()
<xarray.Dataset>
Dimensions:  (animal: 2, date: 2)
Coordinates:
  * date     (date) datetime64[ns] 2018-01-01 2018-01-02
  * animal   (animal) object 'falcon' 'parrot'
Data variables:
    speed    (date, animal) int64 350 18 361 15


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

Return a list of the values. These are each a scalar type, which is a Python scalar (for str, int, float) or a pandas scalar (for Timestamp/Timedelta/Interval/Period)  Returns
 list
    See also  numpy.ndarray.tolist

Return the array as an a.ndim-levels deep nested list of Python scalars.


pandas.Series.transform   Series.transform(func, axis=0, *args, **kwargs)[source]

Call func on self producing a Series with the same axis shape as self.  Parameters

func:function, str, list-like or dict-like

Function to use for transforming the data. If a function, must either work when passed a Series or when passed to Series.apply. If func is both list-like and dict-like, dict-like behavior takes precedence. Accepted combinations are:  function string function name list-like of functions and/or function names, e.g. [np.exp, 'sqrt'] dict-like of axis labels -> functions, function names or list-like of such.
axis:{0 or ‘index’}

Parameter needed for compatibility with DataFrame.  *args

Positional arguments to pass to func.  **kwargs

Keyword arguments to pass to func.    Returns
 Series

A Series that must have the same length as self.    Raises

ValueError:If the returned Series has a different length than self.

    See also  Series.agg

Only perform aggregating type operations.  Series.apply

Invoke function on a Series.    Notes Functions that mutate the passed object can produce unexpected behavior or errors and are not supported. See Mutating with User Defined Function (UDF) methods for more details. Examples
>>> df = pd.DataFrame({'A': range(3), 'B': range(1, 4)})
>>> df
   A  B
0  0  1
1  1  2
2  2  3
>>> df.transform(lambda x: x + 1)
   A  B
0  1  2
1  2  3
2  3  4
  Even though the resulting Series must have the same length as the input Series, it is possible to provide several input functions:
>>> s = pd.Series(range(3))
>>> s
0    0
1    1
2    2
dtype: int64
>>> s.transform([np.sqrt, np.exp])
       sqrt        exp
0  0.000000   1.000000
1  1.000000   2.718282
2  1.414214   7.389056
  You can call transform on a GroupBy object:
>>> df = pd.DataFrame({
...     "Date": [
...         "2015-05-08", "2015-05-07", "2015-05-06", "2015-05-05",
...         "2015-05-08", "2015-05-07", "2015-05-06", "2015-05-05"],
...     "Data": [5, 8, 6, 1, 50, 100, 60, 120],
... })
>>> df
         Date  Data
0  2015-05-08     5
1  2015-05-07     8
2  2015-05-06     6
3  2015-05-05     1
4  2015-05-08    50
5  2015-05-07   100
6  2015-05-06    60
7  2015-05-05   120
>>> df.groupby('Date')['Data'].transform('sum')
0     55
1    108
2     66
3    121
4     55
5    108
6     66
7    121
Name: Data, dtype: int64

>>> df = pd.DataFrame({
...     "c": [1, 1, 1, 2, 2, 2, 2],
...     "type": ["m", "n", "o", "m", "m", "n", "n"]
... })
>>> df
   c type
0  1    m
1  1    n
2  1    o
3  2    m
4  2    m
5  2    n
6  2    n
>>> df['size'] = df.groupby('c')['type'].transform(len)
>>> df
   c type size
0  1    m    3
1  1    n    3
2  1    o    3
3  2    m    4
4  2    m    4
5  2    n    4
6  2    n    4


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

Return the transpose, which is by definition self.  Returns
 %(klass)s


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

Return Floating division of series and other, element-wise (binary operator truediv). 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.rtruediv

Reverse of the Floating division 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.divide(b, fill_value=0)
a    1.0
b    inf
c    inf
d    0.0
e    NaN
dtype: float64


pandas.Series.truncate   Series.truncate(before=None, after=None, axis=None, copy=True)[source]

Truncate a Series or DataFrame before and after some index value. This is a useful shorthand for boolean indexing based on index values above or below certain thresholds.  Parameters

before:date, str, int

Truncate all rows before this index value.
after:date, str, int

Truncate all rows after this index value.
axis:{0 or ‘index’, 1 or ‘columns’}, optional

Axis to truncate. Truncates the index (rows) by default.
copy:bool, default is True,

Return a copy of the truncated section.    Returns
 type of caller

The truncated Series or DataFrame.      See also  DataFrame.loc

Select a subset of a DataFrame by label.  DataFrame.iloc

Select a subset of a DataFrame by position.    Notes If the index being truncated contains only datetime values, before and after may be specified as strings instead of Timestamps. Examples
>>> df = pd.DataFrame({'A': ['a', 'b', 'c', 'd', 'e'],
...                    'B': ['f', 'g', 'h', 'i', 'j'],
...                    'C': ['k', 'l', 'm', 'n', 'o']},
...                   index=[1, 2, 3, 4, 5])
>>> df
   A  B  C
1  a  f  k
2  b  g  l
3  c  h  m
4  d  i  n
5  e  j  o

>>> df.truncate(before=2, after=4)
   A  B  C
2  b  g  l
3  c  h  m
4  d  i  n
  The columns of a DataFrame can be truncated.
>>> df.truncate(before="A", after="B", axis="columns")
   A  B
1  a  f
2  b  g
3  c  h
4  d  i
5  e  j
  For Series, only rows can be truncated.
>>> df['A'].truncate(before=2, after=4)
2    b
3    c
4    d
Name: A, dtype: object
  The index values in truncate can be datetimes or string dates.
>>> dates = pd.date_range('2016-01-01', '2016-02-01', freq='s')
>>> df = pd.DataFrame(index=dates, data={'A': 1})
>>> df.tail()
                     A
2016-01-31 23:59:56  1
2016-01-31 23:59:57  1
2016-01-31 23:59:58  1
2016-01-31 23:59:59  1
2016-02-01 00:00:00  1

>>> df.truncate(before=pd.Timestamp('2016-01-05'),
...             after=pd.Timestamp('2016-01-10')).tail()
                     A
2016-01-09 23:59:56  1
2016-01-09 23:59:57  1
2016-01-09 23:59:58  1
2016-01-09 23:59:59  1
2016-01-10 00:00:00  1
  Because the index is a DatetimeIndex containing only dates, we can specify before and after as strings. They will be coerced to Timestamps before truncation.
>>> df.truncate('2016-01-05', '2016-01-10').tail()
                     A
2016-01-09 23:59:56  1
2016-01-09 23:59:57  1
2016-01-09 23:59:58  1
2016-01-09 23:59:59  1
2016-01-10 00:00:00  1
  Note that truncate assumes a 0 value for any unspecified time component (midnight). This differs from partial string slicing, which returns any partially matching dates.
>>> df.loc['2016-01-05':'2016-01-10', :].tail()
                     A
2016-01-10 23:59:55  1
2016-01-10 23:59:56  1
2016-01-10 23:59:57  1
2016-01-10 23:59:58  1
2016-01-10 23:59:59  1


pandas.Series.tshift   Series.tshift(periods=1, freq=None, axis=0)[source]

Shift the time index, using the index’s frequency if available.  Deprecated since version 1.1.0: Use shift instead.   Parameters

periods:int

Number of periods to move, can be positive or negative.
freq:DateOffset, timedelta, or str, default None

Increment to use from the tseries module or time rule expressed as a string (e.g. ‘EOM’).
axis:{0 or ‘index’, 1 or ‘columns’, None}, default 0

Corresponds to the axis that contains the Index.    Returns

shifted:Series/DataFrame

   Notes If freq is not specified then tries to use the freq or inferred_freq attributes of the index. If neither of those attributes exist, a ValueError is thrown


pandas.Series.tz_convert   Series.tz_convert(tz, axis=0, level=None, copy=True)[source]

Convert tz-aware axis to target time zone.  Parameters

tz:str or tzinfo object

axis:the axis to convert

level:int, str, default None

If axis is a MultiIndex, convert a specific level. Otherwise must be None.
copy:bool, default True

Also make a copy of the underlying data.    Returns
 {klass}

Object with time zone converted axis.    Raises
 TypeError

If the axis is tz-naive.


pandas.Series.tz_localize   Series.tz_localize(tz, axis=0, level=None, copy=True, ambiguous='raise', nonexistent='raise')[source]

Localize tz-naive index of a Series or DataFrame to target time zone. This operation localizes the Index. To localize the values in a timezone-naive Series, use Series.dt.tz_localize().  Parameters

tz:str or tzinfo

axis:the axis to localize

level:int, str, default None

If axis ia a MultiIndex, localize a specific level. Otherwise must be None.
copy:bool, default True

Also make a copy of the underlying data.
ambiguous:‘infer’, bool-ndarray, ‘NaT’, default ‘raise’

When clocks moved backward due to DST, ambiguous times may arise. For example in Central European Time (UTC+01), when going from 03:00 DST to 02:00 non-DST, 02:30:00 local time occurs both at 00:30:00 UTC and at 01:30:00 UTC. In such a situation, the ambiguous parameter dictates how ambiguous times should be handled.  ‘infer’ will attempt to infer fall dst-transition hours based on order bool-ndarray where True signifies a DST time, False designates a non-DST time (note that this flag is only applicable for ambiguous times) ‘NaT’ will return NaT where there are ambiguous times ‘raise’ will raise an AmbiguousTimeError if there are ambiguous times.
nonexistent:str, default ‘raise’

A nonexistent time does not exist in a particular timezone where clocks moved forward due to DST. Valid values are:  ‘shift_forward’ will shift the nonexistent time forward to the closest existing time ‘shift_backward’ will shift the nonexistent time backward to the closest existing time ‘NaT’ will return NaT where there are nonexistent times timedelta objects will shift nonexistent times by the timedelta ‘raise’ will raise an NonExistentTimeError if there are nonexistent times.     Returns
 Series or DataFrame

Same type as the input.    Raises
 TypeError

If the TimeSeries is tz-aware and tz is not None.     Examples Localize local times:
>>> s = pd.Series([1],
...               index=pd.DatetimeIndex(['2018-09-15 01:30:00']))
>>> s.tz_localize('CET')
2018-09-15 01:30:00+02:00    1
dtype: int64
  Be careful with DST changes. When there is sequential data, pandas can infer the DST time:
>>> s = pd.Series(range(7),
...               index=pd.DatetimeIndex(['2018-10-28 01:30:00',
...                                       '2018-10-28 02:00:00',
...                                       '2018-10-28 02:30:00',
...                                       '2018-10-28 02:00:00',
...                                       '2018-10-28 02:30:00',
...                                       '2018-10-28 03:00:00',
...                                       '2018-10-28 03:30:00']))
>>> s.tz_localize('CET', ambiguous='infer')
2018-10-28 01:30:00+02:00    0
2018-10-28 02:00:00+02:00    1
2018-10-28 02:30:00+02:00    2
2018-10-28 02:00:00+01:00    3
2018-10-28 02:30:00+01:00    4
2018-10-28 03:00:00+01:00    5
2018-10-28 03:30:00+01:00    6
dtype: int64
  In some cases, inferring the DST is impossible. In such cases, you can pass an ndarray to the ambiguous parameter to set the DST explicitly
>>> s = pd.Series(range(3),
...               index=pd.DatetimeIndex(['2018-10-28 01:20:00',
...                                       '2018-10-28 02:36:00',
...                                       '2018-10-28 03:46:00']))
>>> s.tz_localize('CET', ambiguous=np.array([True, True, False]))
2018-10-28 01:20:00+02:00    0
2018-10-28 02:36:00+02:00    1
2018-10-28 03:46:00+01:00    2
dtype: int64
  If the DST transition causes nonexistent times, you can shift these dates forward or backward with a timedelta object or ‘shift_forward’ or ‘shift_backward’.
>>> s = pd.Series(range(2),
...               index=pd.DatetimeIndex(['2015-03-29 02:30:00',
...                                       '2015-03-29 03:30:00']))
>>> s.tz_localize('Europe/Warsaw', nonexistent='shift_forward')
2015-03-29 03:00:00+02:00    0
2015-03-29 03:30:00+02:00    1
dtype: int64
>>> s.tz_localize('Europe/Warsaw', nonexistent='shift_backward')
2015-03-29 01:59:59.999999999+01:00    0
2015-03-29 03:30:00+02:00              1
dtype: int64
>>> s.tz_localize('Europe/Warsaw', nonexistent=pd.Timedelta('1H'))
2015-03-29 03:30:00+02:00    0
2015-03-29 03:30:00+02:00    1
dtype: int64


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

Return unique values of Series object. Uniques are returned in order of appearance. Hash table-based unique, therefore does NOT sort.  Returns
 ndarray or ExtensionArray

The unique values returned as a NumPy array. See Notes.      See also  unique

Top-level unique method for any 1-d array-like object.  Index.unique

Return Index with unique values from an Index object.    Notes Returns the unique values as a NumPy array. In case of an extension-array backed Series, a new ExtensionArray of that type with just the unique values is returned. This includes
 Categorical Period Datetime with Timezone Interval Sparse IntegerNA
 See Examples section. Examples
>>> pd.Series([2, 1, 3, 3], name='A').unique()
array([2, 1, 3])

>>> pd.Series([pd.Timestamp('2016-01-01') for _ in range(3)]).unique()
array(['2016-01-01T00:00:00.000000000'], dtype='datetime64[ns]')

>>> pd.Series([pd.Timestamp('2016-01-01', tz='US/Eastern')
...            for _ in range(3)]).unique()
<DatetimeArray>
['2016-01-01 00:00:00-05:00']
Length: 1, dtype: datetime64[ns, US/Eastern]
  An Categorical will return categories in the order of appearance and with the same dtype.
>>> pd.Series(pd.Categorical(list('baabc'))).unique()
['b', 'a', 'c']
Categories (3, object): ['a', 'b', 'c']
>>> pd.Series(pd.Categorical(list('baabc'), categories=list('abc'),
...                          ordered=True)).unique()
['b', 'a', 'c']
Categories (3, object): ['a' < 'b' < 'c']


pandas.Series.unstack   Series.unstack(level=- 1, fill_value=None)[source]

Unstack, also known as pivot, Series with MultiIndex to produce DataFrame.  Parameters

level:int, str, or list of these, default last level

Level(s) to unstack, can pass level name.
fill_value:scalar value, default None

Value to use when replacing NaN values.    Returns
 DataFrame

Unstacked Series.     Examples
>>> s = pd.Series([1, 2, 3, 4],
...               index=pd.MultiIndex.from_product([['one', 'two'],
...                                                 ['a', 'b']]))
>>> s
one  a    1
     b    2
two  a    3
     b    4
dtype: int64

>>> s.unstack(level=-1)
     a  b
one  1  2
two  3  4

>>> s.unstack(level=0)
   one  two
a    1    3
b    2    4


pandas.Series.update   Series.update(other)[source]

Modify Series in place using values from passed Series. Uses non-NA values from passed Series to make updates. Aligns on index.  Parameters

other:Series, or object coercible into Series

   Examples
>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, 5, 6]))
>>> s
0    4
1    5
2    6
dtype: int64

>>> s = pd.Series(['a', 'b', 'c'])
>>> s.update(pd.Series(['d', 'e'], index=[0, 2]))
>>> s
0    d
1    b
2    e
dtype: object

>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, 5, 6, 7, 8]))
>>> s
0    4
1    5
2    6
dtype: int64
  If other contains NaNs the corresponding values are not updated in the original Series.
>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, np.nan, 6]))
>>> s
0    4
1    2
2    6
dtype: int64
  other can also be a non-Series object type that is coercible into a Series
>>> s = pd.Series([1, 2, 3])
>>> s.update([4, np.nan, 6])
>>> s
0    4
1    2
2    6
dtype: int64

>>> s = pd.Series([1, 2, 3])
>>> s.update({1: 9})
>>> s
0    1
1    9
2    3
dtype: int64


pandas.Series.value_counts   Series.value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True)[source]

Return a Series containing counts of unique values. The resulting object will be in descending order so that the first element is the most frequently-occurring element. Excludes NA values by default.  Parameters

normalize:bool, default False

If True then the object returned will contain the relative frequencies of the unique values.
sort:bool, default True

Sort by frequencies.
ascending:bool, default False

Sort in ascending order.
bins:int, optional

Rather than count values, group them into half-open bins, a convenience for pd.cut, only works with numeric data.
dropna:bool, default True

Don’t include counts of NaN.    Returns
 Series
    See also  Series.count

Number of non-NA elements in a Series.  DataFrame.count

Number of non-NA elements in a DataFrame.  DataFrame.value_counts

Equivalent method on DataFrames.    Examples
>>> index = pd.Index([3, 1, 2, 3, 4, np.nan])
>>> index.value_counts()
3.0    2
1.0    1
2.0    1
4.0    1
dtype: int64
  With normalize set to True, returns the relative frequency by dividing all values by the sum of values.
>>> s = pd.Series([3, 1, 2, 3, 4, np.nan])
>>> s.value_counts(normalize=True)
3.0    0.4
1.0    0.2
2.0    0.2
4.0    0.2
dtype: float64
  bins Bins can be useful for going from a continuous variable to a categorical variable; instead of counting unique apparitions of values, divide the index in the specified number of half-open bins.
>>> s.value_counts(bins=3)
(0.996, 2.0]    2
(2.0, 3.0]      2
(3.0, 4.0]      1
dtype: int64
  dropna With dropna set to False we can also see NaN index values.
>>> s.value_counts(dropna=False)
3.0    2
1.0    1
2.0    1
4.0    1
NaN    1
dtype: int64


pandas.Series.values   propertySeries.values

Return Series as ndarray or ndarray-like depending on the dtype.  Warning We recommend using Series.array or Series.to_numpy(), depending on whether you need a reference to the underlying data or a NumPy array.   Returns
 numpy.ndarray or ndarray-like
    See also  Series.array

Reference to the underlying data.  Series.to_numpy

A NumPy array representing the underlying data.    Examples
>>> pd.Series([1, 2, 3]).values
array([1, 2, 3])

>>> pd.Series(list('aabc')).values
array(['a', 'a', 'b', 'c'], dtype=object)

>>> pd.Series(list('aabc')).astype('category').values
['a', 'a', 'b', 'c']
Categories (3, object): ['a', 'b', 'c']
  Timezone aware datetime data is converted to UTC:
>>> pd.Series(pd.date_range('20130101', periods=3,
...                         tz='US/Eastern')).values
array(['2013-01-01T05:00:00.000000000',
       '2013-01-02T05:00:00.000000000',
       '2013-01-03T05:00:00.000000000'], dtype='datetime64[ns]')


pandas.Series.var   Series.var(axis=None, skipna=True, level=None, ddof=1, numeric_only=None, **kwargs)[source]

Return unbiased variance over requested axis. Normalized by N-1 by default. This can be changed using the ddof argument.  Parameters

axis:{index (0)}

skipna:bool, default True

Exclude NA/null values. If an entire row/column is NA, the result will be NA.
level:int or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a scalar.
ddof:int, default 1

Delta Degrees of Freedom. The divisor used in calculations is N - ddof, where N represents the number of elements.
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.    Returns
 scalar or Series (if level specified)
   Examples
>>> df = pd.DataFrame({'person_id': [0, 1, 2, 3],
...                   'age': [21, 25, 62, 43],
...                   'height': [1.61, 1.87, 1.49, 2.01]}
...                  ).set_index('person_id')
>>> df
           age  height
person_id
0           21    1.61
1           25    1.87
2           62    1.49
3           43    2.01

>>> df.var()
age       352.916667
height      0.056367
  Alternatively, ddof=0 can be set to normalize by N instead of N-1:
>>> df.var(ddof=0)
age       264.687500
height      0.042275


pandas.Series.view   Series.view(dtype=None)[source]

Create a new view of the Series. This function will return a new Series with a view of the same underlying values in memory, optionally reinterpreted with a new data type. The new data type must preserve the same size in bytes as to not cause index misalignment.  Parameters

dtype:data type

Data type object or one of their string representations.    Returns
 Series

A new Series object as a view of the same data in memory.      See also  numpy.ndarray.view

Equivalent numpy function to create a new view of the same data in memory.    Notes Series are instantiated with dtype=float64 by default. While numpy.ndarray.view() will return a view with the same data type as the original array, Series.view() (without specified dtype) will try using float64 and may fail if the original data type size in bytes is not the same. Examples
>>> s = pd.Series([-2, -1, 0, 1, 2], dtype='int8')
>>> s
0   -2
1   -1
2    0
3    1
4    2
dtype: int8
  The 8 bit signed integer representation of -1 is 0b11111111, but the same bytes represent 255 if read as an 8 bit unsigned integer:
>>> us = s.view('uint8')
>>> us
0    254
1    255
2      0
3      1
4      2
dtype: uint8
  The views share the same underlying values:
>>> us[0] = 128
>>> s
0   -128
1     -1
2      0
3      1
4      2
dtype: int8


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

Replace values where the condition is False.  Parameters

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

Where cond is True, keep the original value. Where False, 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 False 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.mask()

Return an object of same shape as self.    Notes The where method is an application of the if-then idiom. For each element in the calling DataFrame, if cond is True 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 where 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.xs   Series.xs(key, axis=0, level=None, drop_level=True)[source]

Return cross-section from the Series/DataFrame. This method takes a key argument to select data at a particular level of a MultiIndex.  Parameters

key:label or tuple of label

Label contained in the index, or partially in a MultiIndex.
axis:{0 or ‘index’, 1 or ‘columns’}, default 0

Axis to retrieve cross-section on.
level:object, defaults to first n levels (n=1 or len(key))

In case of a key partially contained in a MultiIndex, indicate which levels are used. Levels can be referred by label or position.
drop_level:bool, default True

If False, returns object with same levels as self.    Returns
 Series or DataFrame

Cross-section from the original Series or DataFrame corresponding to the selected index levels.      See also  DataFrame.loc

Access a group of rows and columns by label(s) or a boolean array.  DataFrame.iloc

Purely integer-location based indexing for selection by position.    Notes xs can not be used to set values. MultiIndex Slicers is a generic way to get/set values on any level or levels. It is a superset of xs functionality, see MultiIndex Slicers. Examples
>>> d = {'num_legs': [4, 4, 2, 2],
...      'num_wings': [0, 0, 2, 2],
...      'class': ['mammal', 'mammal', 'mammal', 'bird'],
...      'animal': ['cat', 'dog', 'bat', 'penguin'],
...      'locomotion': ['walks', 'walks', 'flies', 'walks']}
>>> df = pd.DataFrame(data=d)
>>> df = df.set_index(['class', 'animal', 'locomotion'])
>>> df
                           num_legs  num_wings
class  animal  locomotion
mammal cat     walks              4          0
       dog     walks              4          0
       bat     flies              2          2
bird   penguin walks              2          2
  Get values at specified index
>>> df.xs('mammal')
                   num_legs  num_wings
animal locomotion
cat    walks              4          0
dog    walks              4          0
bat    flies              2          2
  Get values at several indexes
>>> df.xs(('mammal', 'dog'))
            num_legs  num_wings
locomotion
walks              4          0
  Get values at specified index and level
>>> df.xs('cat', level=1)
                   num_legs  num_wings
class  locomotion
mammal walks              4          0
  Get values at several indexes and levels
>>> df.xs(('bird', 'walks'),
...       level=[0, 'locomotion'])
         num_legs  num_wings
animal
penguin         2          2
  Get values at specified column and axis
>>> df.xs('num_wings', axis=1)
class   animal   locomotion
mammal  cat      walks         0
        dog      walks         0
        bat      flies         2
bird    penguin  walks         2
Name: num_wings, dtype: int64


pandas.set_option   pandas.set_option(pat, value)=<pandas._config.config.CallableDynamicDoc object>

Sets the value of the specified option. Available options:  compute.[use_bottleneck, use_numba, use_numexpr] display.[chop_threshold, colheader_justify, column_space, date_dayfirst, date_yearfirst, encoding, expand_frame_repr, float_format] display.html.[border, table_schema, use_mathjax] display.[large_repr] display.latex.[escape, longtable, multicolumn, multicolumn_format, multirow, repr] display.[max_categories, max_columns, max_colwidth, max_dir_items, max_info_columns, max_info_rows, max_rows, max_seq_items, memory_usage, min_rows, multi_sparse, notebook_repr_html, pprint_nest_depth, precision, show_dimensions] display.unicode.[ambiguous_as_wide, east_asian_width] display.[width] io.excel.ods.[reader, writer] io.excel.xls.[reader, writer] io.excel.xlsb.[reader] io.excel.xlsm.[reader, writer] io.excel.xlsx.[reader, writer] io.hdf.[default_format, dropna_table] io.parquet.[engine] io.sql.[engine] mode.[chained_assignment, data_manager, sim_interactive, string_storage, use_inf_as_na, use_inf_as_null] plotting.[backend] plotting.matplotlib.[register_converters] styler.format.[decimal, escape, formatter, na_rep, precision, thousands] styler.html.[mathjax] styler.latex.[environment, hrules, multicol_align, multirow_align] styler.render.[encoding, max_columns, max_elements, max_rows, repr] styler.sparse.[columns, index]   Parameters

pat:str

Regexp which should match a single option. Note: partial matches are supported for convenience, but unless you use the full option name (e.g. x.y.z.option_name), your code may break in future versions if new options with similar names are introduced.
value:object

New value of option.    Returns
 None
  Raises
 OptionError if no such option exists
   Notes The available options with its descriptions:  compute.use_bottleneck:bool

Use the bottleneck library to accelerate if it is installed, the default is True Valid values: False,True [default: True] [currently: True]  compute.use_numba:bool

Use the numba engine option for select operations if it is installed, the default is False Valid values: False,True [default: False] [currently: False]  compute.use_numexpr:bool

Use the numexpr library to accelerate computation if it is installed, the default is True Valid values: False,True [default: True] [currently: True]  display.chop_threshold:float or None

if set to a float value, all float values smaller then the given threshold will be displayed as exactly 0 by repr and friends. [default: None] [currently: None]  display.colheader_justify:‘left’/’right’

Controls the justification of column headers. used by DataFrameFormatter. [default: right] [currently: right]  display.column_space No description available.

[default: 12] [currently: 12]  display.date_dayfirst:boolean

When True, prints and parses dates with the day first, eg 20/01/2005 [default: False] [currently: False]  display.date_yearfirst:boolean

When True, prints and parses dates with the year first, eg 2005/01/20 [default: False] [currently: False]  display.encoding:str/unicode

Defaults to the detected encoding of the console. Specifies the encoding to be used for strings returned by to_string, these are generally strings meant to be displayed on the console. [default: utf-8] [currently: utf-8]  display.expand_frame_repr:boolean

Whether to print out the full DataFrame repr for wide DataFrames across multiple lines, max_columns is still respected, but the output will wrap-around across multiple “pages” if its width exceeds display.width. [default: True] [currently: True]  display.float_format:callable

The callable should accept a floating point number and return a string with the desired format of the number. This is used in some places like SeriesFormatter. See formats.format.EngFormatter for an example. [default: None] [currently: None]  display.html.border:int

A border=value attribute is inserted in the <table> tag for the DataFrame HTML repr. [default: 1] [currently: 1]  display.html.table_schema:boolean

Whether to publish a Table Schema representation for frontends that support it. (default: False) [default: False] [currently: False]  display.html.use_mathjax:boolean

When True, Jupyter notebook will process table contents using MathJax, rendering mathematical expressions enclosed by the dollar symbol. (default: True) [default: True] [currently: True]  display.large_repr:‘truncate’/’info’

For DataFrames exceeding max_rows/max_cols, the repr (and HTML repr) can show a truncated table (the default from 0.13), or switch to the view from df.info() (the behaviour in earlier versions of pandas). [default: truncate] [currently: truncate]  display.latex.escape:bool

This specifies if the to_latex method of a Dataframe uses escapes special characters. Valid values: False,True [default: True] [currently: True]  display.latex.longtable :bool

This specifies if the to_latex method of a Dataframe uses the longtable format. Valid values: False,True [default: False] [currently: False]  display.latex.multicolumn:bool

This specifies if the to_latex method of a Dataframe uses multicolumns to pretty-print MultiIndex columns. Valid values: False,True [default: True] [currently: True]  display.latex.multicolumn_format:bool

This specifies if the to_latex method of a Dataframe uses multicolumns to pretty-print MultiIndex columns. Valid values: False,True [default: l] [currently: l]  display.latex.multirow:bool

This specifies if the to_latex method of a Dataframe uses multirows to pretty-print MultiIndex rows. Valid values: False,True [default: False] [currently: False]  display.latex.repr:boolean

Whether to produce a latex DataFrame representation for jupyter environments that support it. (default: False) [default: False] [currently: False]  display.max_categories:int

This sets the maximum number of categories pandas should output when printing out a Categorical or a Series of dtype “category”. [default: 8] [currently: 8]  display.max_columns:int

If max_cols is exceeded, switch to truncate view. Depending on large_repr, objects are either centrally truncated or printed as a summary view. ‘None’ value means unlimited. In case python/IPython is running in a terminal and large_repr equals ‘truncate’ this can be set to 0 and pandas will auto-detect the width of the terminal and print a truncated object which fits the screen width. The IPython notebook, IPython qtconsole, or IDLE do not run in a terminal and hence it is not possible to do correct auto-detection. [default: 0] [currently: 0]  display.max_colwidth:int or None

The maximum width in characters of a column in the repr of a pandas data structure. When the column overflows, a “…” placeholder is embedded in the output. A ‘None’ value means unlimited. [default: 50] [currently: 50]  display.max_dir_items:int

The number of items that will be added to dir(…). ‘None’ value means unlimited. Because dir is cached, changing this option will not immediately affect already existing dataframes until a column is deleted or added. This is for instance used to suggest columns from a dataframe to tab completion. [default: 100] [currently: 100]  display.max_info_columns:int

max_info_columns is used in DataFrame.info method to decide if per column information will be printed. [default: 100] [currently: 100]  display.max_info_rows:int or None

df.info() will usually show null-counts for each column. For large frames this can be quite slow. max_info_rows and max_info_cols limit this null check only to frames with smaller dimensions than specified. [default: 1690785] [currently: 1690785]  display.max_rows:int

If max_rows is exceeded, switch to truncate view. Depending on large_repr, objects are either centrally truncated or printed as a summary view. ‘None’ value means unlimited. In case python/IPython is running in a terminal and large_repr equals ‘truncate’ this can be set to 0 and pandas will auto-detect the height of the terminal and print a truncated object which fits the screen height. The IPython notebook, IPython qtconsole, or IDLE do not run in a terminal and hence it is not possible to do correct auto-detection. [default: 60] [currently: 60]  display.max_seq_items:int or None

When pretty-printing a long sequence, no more then max_seq_items will be printed. If items are omitted, they will be denoted by the addition of “…” to the resulting string. If set to None, the number of items to be printed is unlimited. [default: 100] [currently: 100]  display.memory_usage:bool, string or None

This specifies if the memory usage of a DataFrame should be displayed when df.info() is called. Valid values True,False,’deep’ [default: True] [currently: True]  display.min_rows:int

The numbers of rows to show in a truncated view (when max_rows is exceeded). Ignored when max_rows is set to None or 0. When set to None, follows the value of max_rows. [default: 10] [currently: 10]  display.multi_sparse:boolean

“sparsify” MultiIndex display (don’t display repeated elements in outer levels within groups) [default: True] [currently: True]  display.notebook_repr_html:boolean

When True, IPython notebook will use html representation for pandas objects (if it is available). [default: True] [currently: True]  display.pprint_nest_depth:int

Controls the number of nested levels to process when pretty-printing [default: 3] [currently: 3]  display.precision:int

Floating point output precision in terms of number of places after the decimal, for regular formatting as well as scientific notation. Similar to precision in numpy.set_printoptions(). [default: 6] [currently: 6]  display.show_dimensions:boolean or ‘truncate’

Whether to print out dimensions at the end of DataFrame repr. If ‘truncate’ is specified, only print out the dimensions if the frame is truncated (e.g. not display all rows and/or columns) [default: truncate] [currently: truncate]  display.unicode.ambiguous_as_wide:boolean

Whether to use the Unicode East Asian Width to calculate the display text width. Enabling this may affect to the performance (default: False) [default: False] [currently: False]  display.unicode.east_asian_width:boolean

Whether to use the Unicode East Asian Width to calculate the display text width. Enabling this may affect to the performance (default: False) [default: False] [currently: False]  display.width:int

Width of the display in characters. In case python/IPython is running in a terminal this can be set to None and pandas will correctly auto-detect the width. Note that the IPython notebook, IPython qtconsole, or IDLE do not run in a terminal and hence it is not possible to correctly detect the width. [default: 80] [currently: 80]  io.excel.ods.reader:string

The default Excel reader engine for ‘ods’ files. Available options: auto, odf. [default: auto] [currently: auto]  io.excel.ods.writer:string

The default Excel writer engine for ‘ods’ files. Available options: auto, odf. [default: auto] [currently: auto]  io.excel.xls.reader:string

The default Excel reader engine for ‘xls’ files. Available options: auto, xlrd. [default: auto] [currently: auto]  io.excel.xls.writer:string

The default Excel writer engine for ‘xls’ files. Available options: auto, xlwt. [default: auto] [currently: auto] (Deprecated, use `` instead.)  io.excel.xlsb.reader:string

The default Excel reader engine for ‘xlsb’ files. Available options: auto, pyxlsb. [default: auto] [currently: auto]  io.excel.xlsm.reader:string

The default Excel reader engine for ‘xlsm’ files. Available options: auto, xlrd, openpyxl. [default: auto] [currently: auto]  io.excel.xlsm.writer:string

The default Excel writer engine for ‘xlsm’ files. Available options: auto, openpyxl. [default: auto] [currently: auto]  io.excel.xlsx.reader:string

The default Excel reader engine for ‘xlsx’ files. Available options: auto, xlrd, openpyxl. [default: auto] [currently: auto]  io.excel.xlsx.writer:string

The default Excel writer engine for ‘xlsx’ files. Available options: auto, openpyxl, xlsxwriter. [default: auto] [currently: auto]  io.hdf.default_format:format

default format writing format, if None, then put will default to ‘fixed’ and append will default to ‘table’ [default: None] [currently: None]  io.hdf.dropna_table:boolean

drop ALL nan rows when appending to a table [default: False] [currently: False]  io.parquet.engine:string

The default parquet reader/writer engine. Available options: ‘auto’, ‘pyarrow’, ‘fastparquet’, the default is ‘auto’ [default: auto] [currently: auto]  io.sql.engine:string

The default sql reader/writer engine. Available options: ‘auto’, ‘sqlalchemy’, the default is ‘auto’ [default: auto] [currently: auto]  mode.chained_assignment:string

Raise an exception, warn, or no action if trying to use chained assignment, The default is warn [default: warn] [currently: warn]  mode.data_manager:string

Internal data manager type; can be “block” or “array”. Defaults to “block”, unless overridden by the ‘PANDAS_DATA_MANAGER’ environment variable (needs to be set before pandas is imported). [default: block] [currently: block]  mode.sim_interactive:boolean

Whether to simulate interactive mode for purposes of testing [default: False] [currently: False]  mode.string_storage:string

The default storage for StringDtype. [default: python] [currently: python]  mode.use_inf_as_na:boolean

True means treat None, NaN, INF, -INF as NA (old way), False means None and NaN are null, but INF, -INF are not NA (new way). [default: False] [currently: False]  mode.use_inf_as_null:boolean

use_inf_as_null had been deprecated and will be removed in a future version. Use use_inf_as_na instead. [default: False] [currently: False] (Deprecated, use mode.use_inf_as_na instead.)  plotting.backend:str

The plotting backend to use. The default value is “matplotlib”, the backend provided with pandas. Other backends can be specified by providing the name of the module that implements the backend. [default: matplotlib] [currently: matplotlib]  plotting.matplotlib.register_converters:bool or ‘auto’.

Whether to register converters with matplotlib’s units registry for dates, times, datetimes, and Periods. Toggling to False will remove the converters, restoring any converters that pandas overwrote. [default: auto] [currently: auto]  styler.format.decimal:str

The character representation for the decimal separator for floats and complex. [default: .] [currently: .]  styler.format.escape:str, optional

Whether to escape certain characters according to the given context; html or latex. [default: None] [currently: None]  styler.format.formatter:str, callable, dict, optional

A formatter object to be used as default within Styler.format. [default: None] [currently: None]  styler.format.na_rep:str, optional

The string representation for values identified as missing. [default: None] [currently: None]  styler.format.precision:int

The precision for floats and complex numbers. [default: 6] [currently: 6]  styler.format.thousands:str, optional

The character representation for thousands separator for floats, int and complex. [default: None] [currently: None]  styler.html.mathjax:bool

If False will render special CSS classes to table attributes that indicate Mathjax will not be used in Jupyter Notebook. [default: True] [currently: True]  styler.latex.environment:str

The environment to replace \begin{table}. If “longtable” is used results in a specific longtable environment format. [default: None] [currently: None]  styler.latex.hrules:bool

Whether to add horizontal rules on top and bottom and below the headers. [default: False] [currently: False]  styler.latex.multicol_align:{“r”, “c”, “l”, “naive-l”, “naive-r”}

The specifier for horizontal alignment of sparsified LaTeX multicolumns. Pipe decorators can also be added to non-naive values to draw vertical rules, e.g. “|r” will draw a rule on the left side of right aligned merged cells. [default: r] [currently: r]  styler.latex.multirow_align:{“c”, “t”, “b”}

The specifier for vertical alignment of sparsified LaTeX multirows. [default: c] [currently: c]  styler.render.encoding:str

The encoding used for output HTML and LaTeX files. [default: utf-8] [currently: utf-8]  styler.render.max_columns:int, optional

The maximum number of columns that will be rendered. May still be reduced to satsify max_elements, which takes precedence. [default: None] [currently: None]  styler.render.max_elements:int

The maximum number of data-cell (<td>) elements that will be rendered before trimming will occur over columns, rows or both if needed. [default: 262144] [currently: 262144]  styler.render.max_rows:int, optional

The maximum number of rows that will be rendered. May still be reduced to satsify max_elements, which takes precedence. [default: None] [currently: None]  styler.render.repr:str

Determine which output to use in Jupyter Notebook in {“html”, “latex”}. [default: html] [currently: html]  styler.sparse.columns:bool

Whether to sparsify the display of hierarchical columns. Setting to False will display each explicit level element in a hierarchical key for each column. [default: True] [currently: True]  styler.sparse.index:bool

Whether to sparsify the display of a hierarchical index. Setting to False will display each explicit level element in a hierarchical key for each row. [default: True] [currently: True]


pandas.show_versions   pandas.show_versions(as_json=False)[source]

Provide useful information, important for bug reports. It comprises info about hosting operation system, pandas version, and versions of other installed relative packages.  Parameters

as_json:str or bool, default False

 If False, outputs info in a human readable form to the console. If str, it will be considered as a path to a file. Info will be written to that file in JSON format. If True, outputs info in JSON format to the console.


pandas.SparseDtype   classpandas.SparseDtype(dtype=<class 'numpy.float64'>, fill_value=None)[source]

Dtype for data stored in SparseArray. This dtype implements the pandas ExtensionDtype interface.  Parameters

dtype:str, ExtensionDtype, numpy.dtype, type, default numpy.float64

The dtype of the underlying array storing the non-fill value values.
fill_value:scalar, optional

The scalar value not stored in the SparseArray. By default, this depends on dtype.
dtype na_value
float np.nan
int 0
bool False
datetime64 pd.NaT
timedelta64 pd.NaT    The default value may be overridden by specifying a fill_value.     Attributes
None     Methods
None


pandas.StringDtype   classpandas.StringDtype(storage=None)[source]

Extension dtype for string data.  New in version 1.0.0.   Warning StringDtype is considered experimental. The implementation and parts of the API may change without warning. In particular, StringDtype.na_value may change to no longer be numpy.nan.   Parameters

storage:{“python”, “pyarrow”}, optional

If not given, the value of pd.options.mode.string_storage.     Examples
>>> pd.StringDtype()
string[python]

>>> pd.StringDtype(storage="pyarrow")
string[pyarrow]
  Attributes
None     Methods
None


pandas.test   pandas.test(extra_args=None)[source]

Run the pandas test suite using pytest.


pandas.testing.assert_extension_array_equal   pandas.testing.assert_extension_array_equal(left, right, check_dtype=True, index_values=None, check_less_precise=NoDefault.no_default, check_exact=False, rtol=1e-05, atol=1e-08)[source]

Check that left and right ExtensionArrays are equal.  Parameters

left, right:ExtensionArray

The two arrays to compare.
check_dtype:bool, default True

Whether to check if the ExtensionArray dtypes are identical.
index_values:numpy.ndarray, default None

Optional index (shared by both left and right), used in output.
check_less_precise:bool or int, default False

Specify comparison precision. Only used when check_exact is False. 5 digits (False) or 3 digits (True) after decimal points are compared. If int, then specify the digits to compare.  Deprecated since version 1.1.0: Use rtol and atol instead to define relative/absolute tolerance, respectively. Similar to math.isclose().
check_exact:bool, default False

Whether to compare number exactly.
rtol:float, default 1e-5

Relative tolerance. Only used when check_exact is False.  New in version 1.1.0.
atol:float, default 1e-8

Absolute tolerance. Only used when check_exact is False.  New in version 1.1.0.      Notes Missing values are checked separately from valid values. A mask of missing values is computed for each and checked to match. The remaining all-valid values are cast to object dtype and checked. Examples
>>> from pandas import testing as tm
>>> a = pd.Series([1, 2, 3, 4])
>>> b, c = a.array, a.array
>>> tm.assert_extension_array_equal(b, c)


pandas.testing.assert_frame_equal   pandas.testing.assert_frame_equal(left, right, check_dtype=True, check_index_type='equiv', check_column_type='equiv', check_frame_type=True, check_less_precise=NoDefault.no_default, check_names=True, by_blocks=False, check_exact=False, check_datetimelike_compat=False, check_categorical=True, check_like=False, check_freq=True, check_flags=True, rtol=1e-05, atol=1e-08, obj='DataFrame')[source]

Check that left and right DataFrame are equal. This function is intended to compare two DataFrames and output any differences. Is is mostly intended for use in unit tests. Additional parameters allow varying the strictness of the equality checks performed.  Parameters

left:DataFrame

First DataFrame to compare.
right:DataFrame

Second DataFrame to compare.
check_dtype:bool, default True

Whether to check the DataFrame dtype is identical.
check_index_type:bool or {‘equiv’}, default ‘equiv’

Whether to check the Index class, dtype and inferred_type are identical.
check_column_type:bool or {‘equiv’}, default ‘equiv’

Whether to check the columns class, dtype and inferred_type are identical. Is passed as the exact argument of assert_index_equal().
check_frame_type:bool, default True

Whether to check the DataFrame class is identical.
check_less_precise:bool or int, default False

Specify comparison precision. Only used when check_exact is False. 5 digits (False) or 3 digits (True) after decimal points are compared. If int, then specify the digits to compare. When comparing two numbers, if the first number has magnitude less than 1e-5, we compare the two numbers directly and check whether they are equivalent within the specified precision. Otherwise, we compare the ratio of the second number to the first number and check whether it is equivalent to 1 within the specified precision.  Deprecated since version 1.1.0: Use rtol and atol instead to define relative/absolute tolerance, respectively. Similar to math.isclose().
check_names:bool, default True

Whether to check that the names attribute for both the index and column attributes of the DataFrame is identical.
by_blocks:bool, default False

Specify how to compare internal data. If False, compare by columns. If True, compare by blocks.
check_exact:bool, default False

Whether to compare number exactly.
check_datetimelike_compat:bool, default False

Compare datetime-like which is comparable ignoring dtype.
check_categorical:bool, default True

Whether to compare internal Categorical exactly.
check_like:bool, default False

If True, ignore the order of index & columns. Note: index labels must match their respective rows (same as in columns) - same labels must be with the same data.
check_freq:bool, default True

Whether to check the freq attribute on a DatetimeIndex or TimedeltaIndex.  New in version 1.1.0.
check_flags:bool, default True

Whether to check the flags attribute.
rtol:float, default 1e-5

Relative tolerance. Only used when check_exact is False.  New in version 1.1.0.
atol:float, default 1e-8

Absolute tolerance. Only used when check_exact is False.  New in version 1.1.0.
obj:str, default ‘DataFrame’

Specify object name being compared, internally used to show appropriate assertion message.      See also  assert_series_equal

Equivalent method for asserting Series equality.  DataFrame.equals

Check DataFrame equality.    Examples This example shows comparing two DataFrames that are equal but with columns of differing dtypes.
>>> from pandas.testing import assert_frame_equal
>>> df1 = pd.DataFrame({'a': [1, 2], 'b': [3, 4]})
>>> df2 = pd.DataFrame({'a': [1, 2], 'b': [3.0, 4.0]})
  df1 equals itself.
>>> assert_frame_equal(df1, df1)
  df1 differs from df2 as column ‘b’ is of a different type.
>>> assert_frame_equal(df1, df2)
Traceback (most recent call last):
...
AssertionError: Attributes of DataFrame.iloc[:, 1] (column name="b") are different
  Attribute “dtype” are different [left]: int64 [right]: float64 Ignore differing dtypes in columns with check_dtype.
>>> assert_frame_equal(df1, df2, check_dtype=False)


pandas.testing.assert_index_equal   pandas.testing.assert_index_equal(left, right, exact='equiv', check_names=True, check_less_precise=NoDefault.no_default, check_exact=True, check_categorical=True, check_order=True, rtol=1e-05, atol=1e-08, obj='Index')[source]

Check that left and right Index are equal.  Parameters

left:Index

right:Index

exact:bool or {‘equiv’}, default ‘equiv’

Whether to check the Index class, dtype and inferred_type are identical. If ‘equiv’, then RangeIndex can be substituted for Int64Index as well.
check_names:bool, default True

Whether to check the names attribute.
check_less_precise:bool or int, default False

Specify comparison precision. Only used when check_exact is False. 5 digits (False) or 3 digits (True) after decimal points are compared. If int, then specify the digits to compare.  Deprecated since version 1.1.0: Use rtol and atol instead to define relative/absolute tolerance, respectively. Similar to math.isclose().
check_exact:bool, default True

Whether to compare number exactly.
check_categorical:bool, default True

Whether to compare internal Categorical exactly.
check_order:bool, default True

Whether to compare the order of index entries as well as their values. If True, both indexes must contain the same elements, in the same order. If False, both indexes must contain the same elements, but in any order.  New in version 1.2.0.
rtol:float, default 1e-5

Relative tolerance. Only used when check_exact is False.  New in version 1.1.0.
atol:float, default 1e-8

Absolute tolerance. Only used when check_exact is False.  New in version 1.1.0.
obj:str, default ‘Index’

Specify object name being compared, internally used to show appropriate assertion message.     Examples
>>> from pandas import testing as tm
>>> a = pd.Index([1, 2, 3])
>>> b = pd.Index([1, 2, 3])
>>> tm.assert_index_equal(a, b)


pandas.testing.assert_series_equal   pandas.testing.assert_series_equal(left, right, check_dtype=True, check_index_type='equiv', check_series_type=True, check_less_precise=NoDefault.no_default, check_names=True, check_exact=False, check_datetimelike_compat=False, check_categorical=True, check_category_order=True, check_freq=True, check_flags=True, rtol=1e-05, atol=1e-08, obj='Series', *, check_index=True)[source]

Check that left and right Series are equal.  Parameters

left:Series

right:Series

check_dtype:bool, default True

Whether to check the Series dtype is identical.
check_index_type:bool or {‘equiv’}, default ‘equiv’

Whether to check the Index class, dtype and inferred_type are identical.
check_series_type:bool, default True

Whether to check the Series class is identical.
check_less_precise:bool or int, default False

Specify comparison precision. Only used when check_exact is False. 5 digits (False) or 3 digits (True) after decimal points are compared. If int, then specify the digits to compare. When comparing two numbers, if the first number has magnitude less than 1e-5, we compare the two numbers directly and check whether they are equivalent within the specified precision. Otherwise, we compare the ratio of the second number to the first number and check whether it is equivalent to 1 within the specified precision.  Deprecated since version 1.1.0: Use rtol and atol instead to define relative/absolute tolerance, respectively. Similar to math.isclose().
check_names:bool, default True

Whether to check the Series and Index names attribute.
check_exact:bool, default False

Whether to compare number exactly.
check_datetimelike_compat:bool, default False

Compare datetime-like which is comparable ignoring dtype.
check_categorical:bool, default True

Whether to compare internal Categorical exactly.
check_category_order:bool, default True

Whether to compare category order of internal Categoricals.  New in version 1.0.2.
check_freq:bool, default True

Whether to check the freq attribute on a DatetimeIndex or TimedeltaIndex.  New in version 1.1.0.
check_flags:bool, default True

Whether to check the flags attribute.  New in version 1.2.0.
rtol:float, default 1e-5

Relative tolerance. Only used when check_exact is False.  New in version 1.1.0.
atol:float, default 1e-8

Absolute tolerance. Only used when check_exact is False.  New in version 1.1.0.
obj:str, default ‘Series’

Specify object name being compared, internally used to show appropriate assertion message.
check_index:bool, default True

Whether to check index equivalence. If False, then compare only values.  New in version 1.3.0.      Examples
>>> from pandas import testing as tm
>>> a = pd.Series([1, 2, 3, 4])
>>> b = pd.Series([1, 2, 3, 4])
>>> tm.assert_series_equal(a, b)


pandas.Timedelta   classpandas.Timedelta(value=<object object>, unit=None, **kwargs)

Represents a duration, the difference between two dates or times. Timedelta is the pandas equivalent of python’s datetime.timedelta and is interchangeable with it in most cases.  Parameters

value:Timedelta, timedelta, np.timedelta64, str, or int

unit:str, default ‘ns’

Denote the unit of the input, if input is an integer. Possible values:  ‘W’, ‘D’, ‘T’, ‘S’, ‘L’, ‘U’, or ‘N’ ‘days’ or ‘day’ ‘hours’, ‘hour’, ‘hr’, or ‘h’ ‘minutes’, ‘minute’, ‘min’, or ‘m’ ‘seconds’, ‘second’, or ‘sec’ ‘milliseconds’, ‘millisecond’, ‘millis’, or ‘milli’ ‘microseconds’, ‘microsecond’, ‘micros’, or ‘micro’ ‘nanoseconds’, ‘nanosecond’, ‘nanos’, ‘nano’, or ‘ns’.   **kwargs

Available kwargs: {days, seconds, microseconds, milliseconds, minutes, hours, weeks}. Values for construction in compat with datetime.timedelta. Numpy ints and floats will be coerced to python ints and floats.     Notes The constructor may take in either both values of value and unit or kwargs as above. Either one of them must be used during initialization The .value attribute is always in ns. If the precision is higher than nanoseconds, the precision of the duration is truncated to nanoseconds. Examples Here we initialize Timedelta object with both value and unit
>>> td = pd.Timedelta(1, "d")
>>> td
Timedelta('1 days 00:00:00')
  Here we initialize the Timedelta object with kwargs
>>> td2 = pd.Timedelta(days=1)
>>> td2
Timedelta('1 days 00:00:00')
  We see that either way we get the same result Attributes
asm8 Return a numpy timedelta64 array scalar view.
components Return a components namedtuple-like.
days Number of days.
delta Return the timedelta in nanoseconds (ns), for internal compatibility.
microseconds Number of microseconds (>= 0 and less than 1 second).
nanoseconds Return the number of nanoseconds (n), where 0 <= n < 1 microsecond.
resolution_string Return a string representing the lowest timedelta resolution.
seconds Number of seconds (>= 0 and less than 1 day).
freq
is_populated
value     Methods
ceil(freq) Return a new Timedelta ceiled to this resolution.
floor(freq) Return a new Timedelta floored to this resolution.
isoformat Format Timedelta as ISO 8601 Duration like P[n]Y[n]M[n]DT[n]H[n]M[n]S, where the [n] s are replaced by the values.
round(freq) Round the Timedelta to the specified resolution.
to_numpy Convert the Timedelta to a NumPy timedelta64.
to_pytimedelta Convert a pandas Timedelta object into a python datetime.timedelta object.
to_timedelta64 Return a numpy.timedelta64 object with 'ns' precision.
total_seconds Total seconds in the duration.
view Array view compatibility.


pandas.Timedelta.asm8   Timedelta.asm8

Return a numpy timedelta64 array scalar view. Provides access to the array scalar view (i.e. a combination of the value and the units) associated with the numpy.timedelta64().view(), including a 64-bit integer representation of the timedelta in nanoseconds (Python int compatible).  Returns
 numpy timedelta64 array scalar view

Array scalar view of the timedelta in nanoseconds.     Examples
>>> td = pd.Timedelta('1 days 2 min 3 us 42 ns')
>>> td.asm8
numpy.timedelta64(86520000003042,'ns')

>>> td = pd.Timedelta('2 min 3 s')
>>> td.asm8
numpy.timedelta64(123000000000,'ns')

>>> td = pd.Timedelta('3 ms 5 us')
>>> td.asm8
numpy.timedelta64(3005000,'ns')

>>> td = pd.Timedelta(42, unit='ns')
>>> td.asm8
numpy.timedelta64(42,'ns')


pandas.Timedelta.ceil   Timedelta.ceil(freq)

Return a new Timedelta ceiled to this resolution.  Parameters

freq:str

Frequency string indicating the ceiling resolution.


pandas.Timedelta.components   Timedelta.components

Return a components namedtuple-like.


pandas.Timedelta.days   Timedelta.days

Number of days.


pandas.Timedelta.delta   Timedelta.delta

Return the timedelta in nanoseconds (ns), for internal compatibility.  Returns
 int

Timedelta in nanoseconds.     Examples
>>> td = pd.Timedelta('1 days 42 ns')
>>> td.delta
86400000000042

>>> td = pd.Timedelta('3 s')
>>> td.delta
3000000000

>>> td = pd.Timedelta('3 ms 5 us')
>>> td.delta
3005000

>>> td = pd.Timedelta(42, unit='ns')
>>> td.delta
42


pandas.Timedelta.floor   Timedelta.floor(freq)

Return a new Timedelta floored to this resolution.  Parameters

freq:str

Frequency string indicating the flooring resolution.


pandas.Timedelta.is_populated   Timedelta.is_populated


pandas.Timedelta.isoformat   Timedelta.isoformat()

Format Timedelta as ISO 8601 Duration like P[n]Y[n]M[n]DT[n]H[n]M[n]S, where the [n] s are replaced by the values. See https://en.wikipedia.org/wiki/ISO_8601#Durations.  Returns
 str
    See also  Timestamp.isoformat

Function is used to convert the given Timestamp object into the ISO format.    Notes The longest component is days, whose value may be larger than 365. Every component is always included, even if its value is 0. Pandas uses nanosecond precision, so up to 9 decimal places may be included in the seconds component. Trailing 0’s are removed from the seconds component after the decimal. We do not 0 pad components, so it’s …T5H…, not …T05H… Examples
>>> td = pd.Timedelta(days=6, minutes=50, seconds=3,
...                   milliseconds=10, microseconds=10, nanoseconds=12)

>>> td.isoformat()
'P6DT0H50M3.010010012S'
>>> pd.Timedelta(hours=1, seconds=10).isoformat()
'P0DT1H0M10S'
>>> pd.Timedelta(days=500.5).isoformat()
'P500DT12H0M0S'


pandas.Timedelta.max   Timedelta.max=Timedelta('106751 days 23:47:16.854775807')


pandas.Timedelta.microseconds   Timedelta.microseconds

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


pandas.Timedelta.min   Timedelta.min=Timedelta('-106752 days +00:12:43.145224193')


pandas.Timedelta.nanoseconds   Timedelta.nanoseconds

Return the number of nanoseconds (n), where 0 <= n < 1 microsecond.  Returns
 int

Number of nanoseconds.      See also  Timedelta.components

Return all attributes with assigned values (i.e. days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds).    Examples Using string input
>>> td = pd.Timedelta('1 days 2 min 3 us 42 ns')

>>> td.nanoseconds
42
  Using integer input
>>> td = pd.Timedelta(42, unit='ns')
>>> td.nanoseconds
42


pandas.Timedelta.resolution   Timedelta.resolution=Timedelta('0 days 00:00:00.000000001')


pandas.Timedelta.resolution_string   Timedelta.resolution_string

Return a string representing the lowest timedelta resolution. Each timedelta has a defined resolution that represents the lowest OR most granular level of precision. Each level of resolution is represented by a short string as defined below: Resolution: Return value  Days: ‘D’ Hours: ‘H’ Minutes: ‘T’ Seconds: ‘S’ Milliseconds: ‘L’ Microseconds: ‘U’ Nanoseconds: ‘N’   Returns
 str

Timedelta resolution.     Examples
>>> td = pd.Timedelta('1 days 2 min 3 us 42 ns')
>>> td.resolution_string
'N'

>>> td = pd.Timedelta('1 days 2 min 3 us')
>>> td.resolution_string
'U'

>>> td = pd.Timedelta('2 min 3 s')
>>> td.resolution_string
'S'

>>> td = pd.Timedelta(36, unit='us')
>>> td.resolution_string
'U'