Я хочу построить таблицу данных Pandas DataFrame, используя Matplolibight_layout () в Colab.
Во-первых, LaTex не был найден при запуске моего кода в Colab.Я попытался это , но затем я получил ошибку ValueError: list.remove(x): x not in list
.Я получаю ту же ошибку в Jupyter-Lab, но в терминале она работает!
Как мне заставить этот код работать в Colab?
import pandas as pd
import matplotlib.pyplot as plt
# sample data
df = pd.DataFrame()
df['P(S)'] = [0.4, 0.3]
df['P(F)'] = [0.2, 0.1]
fig, ax = plt.subplots()
# hide axes
fig.patch.set_visible(False)
ax.axis('off')
ax.axis('tight')
ax.table(cellText=df.values, colLabels=df.columns, loc='center')
fig.tight_layout()
plt.show()
/usr/local/lib/python3.6/dist-packages/matplotlib/figure.py in get_default_bbox_extra_artists(self)
2234 bbox_artists.extend(ax.get_default_bbox_extra_artists())
2235 # we don't want the figure's patch to influence the bbox calculation
-> 2236 bbox_artists.remove(self.patch)
2237 return bbox_artists
2238
ValueError: list.remove(x): x not in list