I have excel file with data list like:
column 1 column 2 column 3
1 2 2
3 5
6
I want to have a list with arrays for each column.
sampling = pd.read_excel(file_path, sheetname=0, index_row=1)
print(sampling)
array = []
for i in range(0,3):
array2 = sampling['column '+ str(i+1)].tolist()
array.append(array2)
print(array)
column 1 column 2 column 3
0 1.0 2.0 2
1 NaN 3.0 5
2 NaN NaN 6
[[1.0, nan, nan], [2.0, 3.0, nan], [2, 5, 6]]
How to get only non Nan values? I want to have such result
[[1.0], [2.0, 3.0], [2, 5, 6]]