-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.py
39 lines (32 loc) · 1.04 KB
/
upload.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# This will just load and save the data as a numpy array file.
import numpy as np # type: ignore
import pandas as pd # type: ignore
try:
old_data = np.load('temp_data.npy')
except:
old_data = None
print('There is no original temp_data.npy!')
try:
# The first 4 lines within the data file is just random information that we don't need.
header = 4
if old_data:
old_size = old_data.size
data = pd.read_csv('data.csv',header=old_size+header).values
else:
data = pd.read_csv('data.csv',header=header).values
# Figuring out what the data means
# print(type(data))
# print(data)
# print(f'Shape of data = {data.shape}')
# print(f'Number of data points = {data.shape[0]}')
# Testing out Pandas DataFrame class
# df = pd.DataFrame(data)
# print(type(df))
# print(df)
# # df[c][r]
# print(type(df[0][0]))
# print(df[0][0],df[1][0])
np.save('temp_data',data)
print('Saved new data.')
except:
print('There is no data.csv to mine the necessary information!')