pandas.plotting.table

pandas.plotting.table(ax, data, **kwargs)[source]

Helper function to convert DataFrame and Series to matplotlib.table.

Parameters:
ax:Matplotlib axes object
data:DataFrame or Series

Data for table contents.

**kwargs

Keyword arguments to be passed to matplotlib.table.table. If rowLabels or colLabels is not specified, data index or column name will be used.

Returns:
matplotlib table object

Examples

>>> import matplotlib.pyplot as plt
>>> df = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
>>> fix, ax = plt.subplots()
>>> ax.axis('off')
(0.0, 1.0, 0.0, 1.0)
>>> table = pd.plotting.table(ax, df, loc='center',
...                           cellLoc='center', colWidths=list([.2, .2]))
../../_images/pandas-plotting-table-1.png

© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.plotting.table.html