MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_table_dataframe

Function test_table_dataframe

lib/matplotlib/tests/test_table.py:257–271  ·  view source on GitHub ↗
(pd)

Source from the content-addressed store, hash-verified

255
256
257def test_table_dataframe(pd):
258 # Test if Pandas Data Frame can be passed in cellText
259
260 data = {
261 'Letter': ['A', 'B', 'C'],
262 'Number': [100, 200, 300]
263 }
264
265 df = pd.DataFrame(data)
266 fig, ax = plt.subplots()
267 table = ax.table(df, loc='center')
268
269 for r, (index, row) in enumerate(df.iterrows()):
270 for c, col in enumerate(df.columns if r == 0 else row.values):
271 assert table[r if r == 0 else r+1, c].get_text().get_text() == str(col)
272
273
274def test_table_fontsize():

Callers

nothing calls this directly

Calls 2

subplotsMethod · 0.45
get_textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…