Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

Pandas Explode on Multiple columns

I guess you need (note the difference in data for col4 which has None as OP mentioned):

pd.DataFrame([[i] if not isinstance(i,list) else i 
             for i in d1.values()],index=d1.keys()).T

    user paid  last_active  col4
0  user1    Y  11 Jul 2019  data
1  user2    Y  23 Sep 2018  None
2  user3    N  08 Dec 2019  None
3  user4    N  03 Mar 2018  None

Tags:

Python

Pandas

Dataframe

Explode

Related

Undefined class 'AuthResult' in Flutter Finding longest overlapping ranges How to redirect to a gatsby-react page with an onclick event of a component? How to get the MSE of the node in the DecisionTreeRegressor of scikit-learn? Flutter Provider Nested Objects Pandas group by result to columns Docker taking much more space than sum of containers, images and volumes Replace \ with \\ doesn't work for specific variable Serializing Enum as string using attribute in Azure Functions 3.0 Play Install Referrer Library Adding WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE permissions Difference between CoroutineScope and coroutineScope in Kotlin How to use Compose inside Fragment?

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy