mteb/BrightProStackoverflowRetrieval huggingface dataset:
ql.html)
    * [ pandas.read_gbq ](pandas.read_gbq.html)
    * [ pandas.read_stata ](pandas.read_stata.html)
    * [ pandas.DataFrame.to_stata ](pandas.DataFrame.to_stata.html)
    * [ pandas.io.stata.StataReader.data_label ](pandas.io.stata.StataReader.data_label.html)
    * [ pandas.io.stata.StataReader.value_labels ](pandas.io.stata.StataReader.value_labels.html)
    * [ pandas.io.stata.StataReader.variable_labels ](pandas.io.stata.StataReader.variable_labels.html)
    * [ pandas.io.stata.StataWriter.write_file ](pandas.io.stata.StataWriter.write_file.html)
  * [ General functions ](../general_functions.html)
  * [ Series ](../series.html)
  * [ DataFrame ](../frame.html)
  * [ pandas arrays, scalars, and data types ](../arrays.html)
  * [ Index objects ](../indexing.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ Input/output ](../io.html)
  * pandas.DataF... 

#  pandas.DataFrame.to_feather  #

DataFrame.  to_feather  (  _ path  _ , _ **  kwargs  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L2909-L2938) #

    

Write a DataFrame to the binary Feather format.

Parameters  :

    

**path** str, path object, file-like object

    

String, path object (implementing ` os.PathLike[str]  ` ), or file-like object
implementing a binary ` write()  ` function. If a string or a path, it will be
used as Root Directory path when writing a partitioned dataset.

****kwargs**

    

Additional keywords passed to [ ` pyarrow.feather.write_feather()  `
](https://arrow.apache.org/docs/python/generated/pyarrow.feather.write_feather.html#pyarrow.feather.write_feather
"\(in Apache Arrow v15.0.2\)") . This includes the  compression  ,
compression_level  ,  chunksize  and  version  keywords.

Notes

This function writes the dataframe as a [ feather file
](https://arrow.apache.org/docs/python/feather.html) . Requires a default
index. For saving the DataFrame with your custom index use a method that
supports custom indices e.g.  to_parquet  .

Examples

    
    
    >>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]])
    >>> df.to_feather("file.feather")  
    

[ __ previous  pandas.read_feather  ](pandas.read_feather.html "previous
page") [ next  pandas.read_parquet  __ ](pandas.read_parquet.html "next page")

__ On this page

  * ` DataFrame.to_feather()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.to_feather.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
pby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.axes  #

_ property  _ DataFrame.  axes  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L1030-L1045) #

    

Return a list representing the axes of the DataFrame.

It has the row axis labels and column axis labels as the only members. They
are returned in that order.

Examples

    
    
    >>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
    >>> df.axes
    [RangeIndex(start=0, stop=2, step=1), Index(['col1', 'col2'],
    dtype='object')]
    

[ __ previous  pandas.DataFrame.values  ](pandas.DataFrame.values.html
"previous page") [ next  pandas.DataFrame.ndim  __
](pandas.DataFrame.ndim.html "next page")

__ On this page

  * ` DataFrame.axes  `

[ __ Show Source ](../../_sources/reference/api/pandas.DataFrame.axes.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.columns  #

DataFrame.  columns  #

    

The column labels of the DataFrame.

Examples

    
    
    >>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
    >>> df
         A  B
    0    1  3
    1    2  4
    >>> df.columns
    Index(['A', 'B'], dtype='object')
    

[ __ previous  pandas.DataFrame.index  ](pandas.DataFrame.index.html "previous
page") [ next  pandas.DataFrame.dtypes  __ ](pandas.DataFrame.dtypes.html
"next page")

__ On this page

  * ` DataFrame.columns  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.columns.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
l)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.to_markdown  #

DataFrame.  to_markdown  (  _ buf  =  None  _ , _ *  _ , _ mode  =  'wt'  _ ,
_ index  =  True  _ , _ storage_options  =  None  _ , _ **  kwargs  _ )  [
[source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L2940-L2990) #

    

Print DataFrame in Markdown-friendly format.

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.

**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.request.Request  ` as header options. For other URLs
(e.g. starting with âs3://â, and âgcs://â) the key-value pairs are
forwarded to ` fsspec.open  ` . Please see ` fsspec  ` and ` urllib  ` for
more details, and for more examples on storage options refer [ here
](https://pandas.pydata.org/docs/user_guide/io.html?highlight=storage_options#reading-
writing-remote-files) .

****kwargs**

    

These parameters will be passed to [ tabulate
](https://pypi.org/project/tabulate) .

Returns  :

    

str

    

DataFrame in Markdown-friendly format.

Notes

Requires the [ tabulate ](https://pypi.org/project/tabulate) package.

Examples

    
    
    >>> df = pd.DataFrame(
    ...     data={"animal_1": ["elk", "pig"], "animal_2": ["dog", "quetzal"]}
    ... )
    >>> print(df.to_markdown())
    |    | animal_1   | animal_2   |
    |---:|:-----------|:-----------|
    |  0 | elk        | dog        |
    |  1 | pig        | quetzal    |
    

Output markdown with a tabulate option.

    
    
    >>> print(df.to_markdown(tablefmt="grid"))
    +----+------------+------------+
    |    | animal_1   | animal_2   |
    +====+============+============+
    |  0 | elk        | dog        |
    +----+------------+------------+
    |  1 | pig        | quetzal    |
    +----+------------+------------+
    

[ __ previous  pandas.DataFrame.to_string  ](pandas.DataFrame.to_string.html
"previous page") [ next  pandas.DataFrame.style  __
](pandas.DataFrame.style.html "next page")

__ On this page

  * ` DataFrame.to_markdown()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.to_markdown.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
* [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.sparse.to_coo  #

DataFrame.sparse.  to_coo  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/arrays/sparse/accessor.py#L329-L377) #

    

Return the contents of the frame as a sparse SciPy COO matrix.

Returns  :

    

scipy.sparse.spmatrix

    

If the caller is heterogeneous and contains booleans or objects, the result
will be of dtype=object. See Notes.

Notes

The dtype will be the lowest-common-denominator type (implicit upcasting);
that is to say if the dtypes (even of numeric types) are mixed, the one that
accommodates all will be chosen.

e.g. If the dtypes are float16 and float32, dtype will be upcast to float32.
By numpy.find_common_type convention, mixing int64 and and uint64 will result
in a float64 dtype.

Examples

    
    
    >>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0, 1])})
    >>> df.sparse.to_coo()
    <4x1 sparse matrix of type '<class 'numpy.int64'>'
            with 2 stored elements in COOrdinate format>
    

[ __ previous  pandas.DataFrame.sparse.from_spmatrix
](pandas.DataFrame.sparse.from_spmatrix.html "previous page") [ next
pandas.DataFrame.sparse.to_dense  __ ](pandas.DataFrame.sparse.to_dense.html
"next page")

__ On this page

  * ` DataFrame.sparse.to_coo()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.sparse.to_coo.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
ls.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.PeriodIndex ](pandas.PeriodIndex.html)
  * pandas.Perio... 

#  pandas.PeriodIndex.days_in_month  #

_ property  _ PeriodIndex.  days_in_month  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/extension.py#L67-L75) #

    

The number of days in the month.

Examples

For Series:

    
    
    >>> period = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M')
    >>> s = pd.Series(period)
    >>> s
    0   2020-01
    1   2020-02
    2   2020-03
    dtype: period[M]
    >>> s.dt.days_in_month
    0    31
    1    29
    2    31
    dtype: int64
    

For PeriodIndex:

    
    
    >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
    >>> idx.days_in_month   # It can be also entered as `daysinmonth`
    Index([31, 28, 31], dtype='int64')
    

[ __ previous  pandas.PeriodIndex.day_of_year
](pandas.PeriodIndex.day_of_year.html "previous page") [ next
pandas.PeriodIndex.daysinmonth  __ ](pandas.PeriodIndex.daysinmonth.html "next
page")

__ On this page

  * ` PeriodIndex.days_in_month  `

[ __ Show Source
](../../_sources/reference/api/pandas.PeriodIndex.days_in_month.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
tml)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.to_period  #

DataFrame.  to_period  (  _ freq  =  None  _ , _ axis  =  0  _ , _ copy  =
None  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L12305-L12372) #

    

Convert DataFrame from DatetimeIndex to PeriodIndex.

Convert DataFrame from DatetimeIndex to PeriodIndex with desired frequency
(inferred from index if not passed).

Parameters  :

    

**freq** str, default

    

Frequency of the PeriodIndex.

**axis** {0 or âindexâ, 1 or âcolumnsâ}, default 0

    

The axis to convert (the index by default).

**copy** bool, default True

    

If False then underlying input data is not copied.

Note

The  copy  keyword will change behavior in pandas 3.0. [ Copy-on-Write
](https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html) will be
enabled by default, which means that all methods with a  copy  keyword will
use a lazy copy mechanism to defer the copy and ignore the  copy  keyword. The
copy  keyword will be removed in a future version of pandas.

You can already get the future behavior and improvements through enabling copy
on write ` pd.options.mode.copy_on_write  =  True  `

Returns  :

    

DataFrame

    

The DataFrame has a PeriodIndex.

Examples

    
    
    >>> idx = pd.to_datetime(
    ...     [
    ...         "2001-03-31 00:00:00",
    ...         "2002-05-31 00:00:00",
    ...         "2003-08-31 00:00:00",
    ...     ]
    ... )
    
    
    
    >>> idx
    DatetimeIndex(['2001-03-31', '2002-05-31', '2003-08-31'],
    dtype='datetime64[ns]', freq=None)
    
    
    
    >>> idx.to_period("M")
    PeriodIndex(['2001-03', '2002-05', '2003-08'], dtype='period[M]')
    

For the yearly frequency

    
    
    >>> idx.to_period("Y")
    PeriodIndex(['2001', '2002', '2003'], dtype='period[Y-DEC]')
    

[ __ previous  pandas.DataFrame.resample  ](pandas.DataFrame.resample.html
"previous page") [ next  pandas.DataFrame.to_timestamp  __
](pandas.DataFrame.to_timestamp.html "next page")

__ On this page

  * ` DataFrame.to_period()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.to_period.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
* [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataF... 

#  pandas.DataFrame.sparse.to_dense  #

DataFrame.sparse.  to_dense  (  )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/arrays/sparse/accessor.py#L306-L327) #

    

Convert a DataFrame with sparse values to dense.

Returns  :

    

DataFrame

    

A DataFrame with the same values stored as dense arrays.

Examples

    
    
    >>> df = pd.DataFrame({"A": pd.arrays.SparseArray([0, 1, 0])})
    >>> df.sparse.to_dense()
       A
    0  0
    1  1
    2  0
    

[ __ previous  pandas.DataFrame.sparse.to_coo
](pandas.DataFrame.sparse.to_coo.html "previous page") [ next
pandas.DataFrame.from_dict  __ ](pandas.DataFrame.from_dict.html "next page")

__ On this page

  * ` DataFrame.sparse.to_dense()  `

[ __ Show Source
](../../_sources/reference/api/pandas.DataFrame.sparse.to_dense.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
upby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * [ DataFrame ](../frame.html)
  * pandas.DataFrame.dot 

#  pandas.DataFrame.dot  #

DataFrame.  dot  (  _ other  _ )  [ [source]  ](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/frame.py#L1657-L1773) #

    

Compute the matrix multiplication between the DataFrame and other.

This method computes the matrix product between the DataFrame and the values
of an other Series, DataFrame or a numpy array.

It can also be called using ` self  @  other  ` .

Parameters  :

    

**other** Series, DataFrame or array-like

    

The other object to compute the matrix product with.

Returns  :

    

Series or DataFrame

    

If other is a Series, return the matrix product between self and other as a
Series. If other is a DataFrame or a numpy.array, return the matrix product of
self and other in a DataFrame of a np.array.

See also

[ ` Series.dot  ` ](pandas.Series.dot.html#pandas.Series.dot
"pandas.Series.dot")

    

Similar method for Series.

Notes

The dimensions of DataFrame and other must be compatible in order to compute
the matrix multiplication. In addition, the column names of DataFrame and the
index of other must contain the same values, as they will be aligned prior to
the multiplication.

The dot method for Series computes the inner product, instead of the matrix
product here.

Examples

Here we multiply a DataFrame with a Series.

    
    
    >>> df = pd.DataFrame([[0, 1, -2, -1], [1, 1, 1, 1]])
    >>> s = pd.Series([1, 1, 2, 1])
    >>> df.dot(s)
    0    -4
    1     5
    dtype: int64
    

Here we multiply a DataFrame with another DataFrame.

    
    
    >>> other = pd.DataFrame([[0, 1], [1, 2], [-1, -1], [2, 0]])
    >>> df.dot(other)
        0   1
    0   1   4
    1   2   2
    

Note that the dot method give the same result as @

    
    
    >>> df @ other
        0   1
    0   1   4
    1   2   2
    

The dot method works also if other is an np.array.

    
    
    >>> arr = np.array([[0, 1], [1, 2], [-1, -1], [2, 0]])
    >>> df.dot(arr)
        0   1
    0   1   4
    1   2   2
    

Note how shuffling of the objects does not change the result.

    
    
    >>> s2 = s.reindex([1, 0, 2, 3])
    >>> df.dot(s2)
    0    -4
    1     5
    dtype: int64
    

[ __ previous  pandas.DataFrame.pow  ](pandas.DataFrame.pow.html "previous
page") [ next  pandas.DataFrame.radd  __ ](pandas.DataFrame.radd.html "next
page")

__ On this page

  * ` DataFrame.dot()  `

[ __ Show Source ](../../_sources/reference/api/pandas.DataFrame.dot.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.
om_fields ](pandas.PeriodIndex.from_fields.html)
    * [ pandas.PeriodIndex.from_ordinals ](pandas.PeriodIndex.from_ordinals.html)
  * [ Date offsets ](../offset_frequency.html)
  * [ Window ](../window.html)
  * [ GroupBy ](../groupby.html)
  * [ Resampling ](../resampling.html)
  * [ Style ](../style.html)
  * [ Plotting ](../plotting.html)
  * [ Options and settings ](../options.html)
  * [ Extensions ](../extensions.html)
  * [ Testing ](../testing.html)
  * [ Missing values ](../missing_value.html)

  * [ __ ](../../index.html)
  * [ API reference ](../index.html)
  * __
  * [ pandas.MultiIndex ](pandas.MultiIndex.html)
  * pandas.Multi... 

#  pandas.MultiIndex.from_arrays  #

_ classmethod  _ MultiIndex.  from_arrays  (  _ arrays  _ , _ sortorder  =
None  _ , _ names  =  _NoDefault.no_default  _ )  [ [source]
](https://github.com/pandas-
dev/pandas/blob/v2.2.2/pandas/core/indexes/multi.py#L474-L543) #

    

Convert arrays to MultiIndex.

Parameters  :

    

**arrays** list / sequence of array-likes

    

Each array-like gives one levelâs value for each data point. len(arrays) is
the number of levels.

**sortorder** int or None

    

Level of sortedness (must be lexicographically sorted by that level).

**names** list / sequence of str, optional

    

Names for the levels in the index.

Returns  :

    

MultiIndex

    

See also

[ ` MultiIndex.from_tuples  `
](pandas.MultiIndex.from_tuples.html#pandas.MultiIndex.from_tuples
"pandas.MultiIndex.from_tuples")

    

Convert list of tuples to MultiIndex.

[ ` MultiIndex.from_product  `
](pandas.MultiIndex.from_product.html#pandas.MultiIndex.from_product
"pandas.MultiIndex.from_product")

    

Make a MultiIndex from cartesian product of iterables.

[ ` MultiIndex.from_frame  `
](pandas.MultiIndex.from_frame.html#pandas.MultiIndex.from_frame
"pandas.MultiIndex.from_frame")

    

Make a MultiIndex from a DataFrame.

Examples

    
    
    >>> arrays = [[1, 1, 2, 2], ['red', 'blue', 'red', 'blue']]
    >>> pd.MultiIndex.from_arrays(arrays, names=('number', 'color'))
    MultiIndex([(1,  'red'),
                (1, 'blue'),
                (2,  'red'),
                (2, 'blue')],
               names=['number', 'color'])
    

[ __ previous  pandas.MultiIndex.dtypes  ](pandas.MultiIndex.dtypes.html
"previous page") [ next  pandas.MultiIndex.from_tuples  __
](pandas.MultiIndex.from_tuples.html "next page")

__ On this page

  * ` MultiIndex.from_arrays()  `

[ __ Show Source
](../../_sources/reference/api/pandas.MultiIndex.from_arrays.rst.txt)

© 2024, pandas via [ NumFOCUS, Inc. ](https://numfocus.org) Hosted by [
OVHcloud ](https://www.ovhcloud.com) .

Created using [ Sphinx ](https://www.sphinx-doc.org/) 7.2.6.  

Built with the [ PyData Sphinx Theme ](https://pydata-sphinx-
theme.readthedocs.io/en/stable/index.html) 0.14.4.