
pandas to_markdown - Get the markdown text from a Series or DataFrame
import pandas
people = [
('Einstein', 1879, 'physics'),
('Bohr', 1885, 'physics'),
('Weil', 1912, 'mathematics'),
('Keynes', 1883, 'economics'),
]
df = pandas.DataFrame(people, columns=['name', 'born', 'field'])
m = df.to_markdown()
to_markdown returns the markdown from a DataFrame. m is printed like this.
| | name | born | field |
|---:|:---------|-------:|:------------|
| 0 | Einstein | 1879 | physics |
| 1 | Bohr | 1885 | physics |
| 2 | Weil | 1912 | mathematics |
| 3 | Keynes | 1883 | economics |
Comments
Powered by Markdown