简体   繁体   中英

Pandas concatenate all elements of dataframe into single series

There must be a simple answer to this, but for some reason I can't find it. Apologies if this is a duplicate question.

I have a dataframe with shape on the order of (1000,100). I want to concatenate ALL items in the dataframe into a single series (or list). Order doesn't matter (so it doesn't matter what axis to concatenate along). I don't want/need to keep any column names or indices. Dropping NaNs and duplicates is ok but not required.

What's the easiest way to do this?

这将产生所有元素的最低公共dtype的1-dim numpy-array。

df.values.ravel()

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