https://github.com/kyoto7250/mdpd
a simple tool for convert markdown table to pandas
https://github.com/kyoto7250/mdpd
development markdown pandas python3 test
Last synced: about 1 year ago
JSON representation
a simple tool for convert markdown table to pandas
- Host: GitHub
- URL: https://github.com/kyoto7250/mdpd
- Owner: kyoto7250
- License: mit
- Created: 2023-10-07T06:20:04.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-15T03:34:31.000Z (about 1 year ago)
- Last Synced: 2025-05-15T04:27:31.169Z (about 1 year ago)
- Topics: development, markdown, pandas, python3, test
- Language: Python
- Homepage: https://pypi.org/project/mdpd/
- Size: 139 KB
- Stars: 17
- Watchers: 1
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mdpd
`mdpd` is a simpler tool for convert markdown table to pandas.
This tool is a lightweight tool for testing a code, so note that we are not validating the user's input.
## install
```bash
pip install mdpd
```
## usage
```python
import mdpd
df = mdpd.from_md("""
+------------+-------+
| id | score |
+------------+-------+
| 1 | 15 |
| 2 | 11 |
| 3 | 11 |
| 4 | 20 |
+------------+-------+
""")
print(df)
# id score
# 0 1 15
# 1 2 11
# 2 3 11
# 3 4 20
```
```python
# the header can be overwritten if the header exists
import mdpd
df = mdpd.from_md("""
| 1 | 15 |
| 2 | 11 |
| 3 | 11 |
| 4 | 20 |
""", header=["id", "score"])
print(df)
# id score
# 0 1 15
# 1 2 11
# 2 3 11
# 3 4 20
```
## accepted table patterns
```markdown
| Syntax | Description |
| --------- | ----------- |
| Header | Title |
| Paragraph | Text |
```
```markdown
+------------+-------------+
| Syntax | Description |
+------------+-------------+
| Header | Title |
| Paragraph | Text |
+------------+-------------+
```
```markdown
| Syntax | Description |
| :-------- | ----------: |
| Header | Title |
| Paragraph | Text |
```
```markdown
| Header | Title |
| Paragraph | Text |
```
## contribute
If you have suggestions for features or improvements to the code, please feel free to create an issue or PR.