I'm trying to append certain columns of Pandas Data Frames from CSV files into a numpy array. I have no idea how to instantiate an empty numpy array, so I'm testing it first with a list.
def windows(files):
x = []
for my_files in files:
with open(os.path.join("/Users", "saqibali", "PycharmProjects", "sensorLogProject", "Data", my_files),
'rU') as my_file:
df = pd.DataFrame(columns=['timestamp', 'time skipped', 'x', 'y', 'z', 'label']).set_index('timestamp')
for d in sliding_window(sample_difference(my_file), 500, 250):
df = df.append(d[['x', 'y', 'z']])
x.append(df.values.toList())
return x
I get the error in the title, and it doesn't make sense to me because x is a list and df is a Data Frame.