简体   繁体   中英

Transforming a data frame into a line array

I used that to transform a data frame formed of just one column:

data = data_Y.values

However, I'm not happy with the results for the reason that I wanted all the data in a line, and instead I'm getting all the results on different lines. Do you have any idea how either transform:

[[1],[2]] into [1,2]

or directly getting a line vector from my dataframe?

A = np.array([[1],[2]])
B=A.flatten()
assert(np.all(B==np.array([1,2])))

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