pandas.plotting.table#
- pandas.plotting.table(ax, data, **kwargs)[源代码]#
将 DataFrame 和 Series 转换为 matplotlib.table 的辅助函数。
- Parameters:
- axMatplotlib 坐标轴对象
- dataDataFrame 或 Series
表格内容的数据。
- **kwargs
要传递给 matplotlib.table.table 的关键字参数。如果未指定 rowLabels 或 colLabels,则将使用数据索引或列名。
- Returns:
- matplotlib 表格对象
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]))