Skip to content

Tag: pandas

String column to multiple columns in DataFrame

I have a DataFrame with multiple columns: Now I want to break column C(whose each entry is separated by n) into multiple column like this: I tried few techniques but can’t make it. I tried to use df.apply but not able to fix NA columns. Is there a way to cleanly achieve this? Thanks. Answer A solution u…

Create new dataframe from an existing dataframe

I have a pandas dataframe with say 6 columns. 3 of the columns are of length 5. Two of the columns are of length 2 and the last column is of length 8. The columns are randomly positioned in the dataframe. I would like to create 3 new dataframes. The first dataframe should only contain all the columns whose le…

Build a dask dataframe from a list of dask delayed objects

I have a list of dask delayed objects Portfolio_perfs: Each delayed object is a numpy array of length 2 I want to build the following dataframe without using dask.compute: How can I build this dask dataframe without going through dask.compute? Thank you Answer Since each delayed object is a numpy array, you a…