mirror of
https://github.com/bvanroll/college-datascience.git
synced 2025-08-29 12:02:45 +00:00
28 lines
462 B
Python
28 lines
462 B
Python
import pandas as pd
|
|
|
|
|
|
with open("DataScienceData01.txt","r") as infile:
|
|
lines = infile.readlines()
|
|
|
|
|
|
|
|
def dataParse(l):
|
|
objs = l.split("& ")
|
|
dic = {}
|
|
for obj in objs:
|
|
items = obj.split("=")
|
|
title = items[0]
|
|
data = items[1].split(",")
|
|
if len(data) == 1:
|
|
data = data[0]
|
|
dic[title] = data
|
|
return dic
|
|
|
|
|
|
data = []
|
|
for l in lines:
|
|
data.append(dataParse(l))
|
|
|
|
df = pd.DataFrame(data)
|
|
print(df)
|