简体   繁体   中英

retrieving data from a numpy array and storing in a dataframe

I currently have a .npy file and I would like to store the data it contains in a variable in order to convert it to a dataframe.

I tried using the following:

data_array=np.load('Jason1Data_Full_East_West.npy')
df = pd.DataFrame(data_array)

However my dataframe came out as a single column. How do I save the data in a format where the columns are clearly separated with now square brackets around the rows?

Below is the result I am currently getting. 在此处输入图片说明

Even your question is not clear. You can try the following:

path = .../Jason1Data_Full_East_West.npy
data = np.load(path)

And then you need to convert it to dataframe as the following:

pd.DataFrame({'Data':data.tolist()})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM