mirror of
https://github.com/bvanroll/college-datascience.git
synced 2025-08-30 04:22:39 +00:00
ugh
This commit is contained in:
27
project/readData.py
Normal file
27
project/readData.py
Normal file
@@ -0,0 +1,27 @@
|
||||
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)
|
Reference in New Issue
Block a user