Skip to content Skip to sidebar Skip to footer

How To Change The Shape Of A Pandas Dataframe (row Number With An "L")?

I have a one column pandas dataframe of the shape (362L,), and would like to change it to (362, 103). How can I do that?

Solution 1:

Just figured out, since the object of the shape (362L,) is really a pandas series, I just need to change it to dataframe, like this:

pd.DataFrame(df)

That's it!


Solution 2:

use

df.iloc[:, 0].apply(pd.Series)

Post a Comment for "How To Change The Shape Of A Pandas Dataframe (row Number With An "L")?"