0

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:
enter image description here

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

Comments

0

Try this:

import pandas as pd

df = <load your data into a pandas dataframe>
df.style.hide(axis='index')

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.