Created
December 3, 2017 15:42
-
-
Save milo0/94bc50e4de48d4a6d1b7b696fb319e75 to your computer and use it in GitHub Desktop.
Convert tables posted on StackOverflow to pandas DataFrames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
with open('table.txt') as f: | |
content = f.readlines() | |
columns = content.pop(0) | |
content_list = [row.split() for row in content] | |
df = pd.DataFrame(columns=columns, data=content_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment