Reputation: 11
I'm using pandas.plotting.table
to generate a matplotlib table for my data. The pandas documentation states that if the rowLabels
kwarg is not specified, it uses the data index. However, I want to plot my data without the index at all. I couldn't find a way to override the setting in the pyplot table either.
Currently my output looks like this:
Upvotes: 0
Views: 6192
Reputation: 301
Try this:
import pandas as pd
df = <load your data into a pandas dataframe>
df.style.hide(axis='index')
Upvotes: 0
Reputation: 300
I found it easier to bypass pandas
and to fallback to calling matplotlib
routines to do the plotting.
import matplotlib.pyplot as plt
import pandas as pd
df = <load your data into a pandas dataframe>
fig, ax = plt.subplots(1, 1)
ax.table(cellText=df.values, colLabels=df.keys(), loc='center')
plt.show()
See the docs for ax.table
Upvotes: 3