Created
April 16, 2020 12:20
-
-
Save fruch/02ea79e7559947c4619db272be9793b7 to your computer and use it in GitHub Desktop.
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 numpy as np | |
import pandas as pd | |
import csv | |
input = "" | |
for l in open('/home/fruch/Downloads/data_short.csv').readlines(): | |
input += l.replace('"', '') + '\n' | |
with open('/home/fruch/Downloads/data_short_clean.csv', 'w') as f: | |
f.write(input) | |
data = pd.read_csv('/home/fruch/Downloads/data_short_clean.csv', encoding='utf-8') | |
print(data.keys()) | |
dataTypeSeries = data.dtypes # check the type of each column | |
print(data) | |
print('Data type of columns :') | |
print(dataTypeSeries) | |
data['cases'] = data['cases'].apply(pd.to_numeric) | |
print(data) | |
dataTypeSeries = data.dtypes # check the type of each column | |
print('Data type of columns :') | |
print(dataTypeSeries) | |
exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment