How to separate column in dataframe pandas
Apply the pandas series str. split() function on the “Address” column and pass the delimiter (comma in this case) on which you want to split the column. Also, make sure to pass True to the expand parameter.
I have DataFrame containing values about shops and categories in one column.




Date
Spent
...
Category/Shop




2022-08-04
126.98
...
Supermarkets


2022-08-04
NaN
...
ShopName


2022-08-04
119.70
...
Supermarkets


2022-08-04
NaN
...
ShopName




...
I need to separate last column into to columns:




Date
Spent
...
Category
Shop




2022-08-04
126.98
...
Supermarkets
ShopName


2022-08-04
119.70
...
Supermarkets
ShopName




How can this be done?
We can assume that every second row in the Category/Shop column contains the name of the store that needs to be moved to a new column.