Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

explode dictionary pandas

arxivdf.reset_index(inplace=True) # didn't drop the index coz I will need it later
tmp = arxivdf.explode('data') # 'data' is the column that has a list of dictionaries
dict2df = tmp['data'].apply(pd.Series)[['category', 'link', 'summary', 'title']] # the column passed are keys, 
arxivdf = pd.concat((tmp,dict2df),axis=1) # concatenate to have everything in on df
Comment

PREVIOUS NEXT
Code Example
Python :: python move directory 
Python :: sample datafra,e PYTHON 
Python :: define variable with if statement python 
Python :: python filename without extension 
Python :: how to print variables in a string python 
Python :: telethon get all channels 
Python :: sort list of dictionaries python 
Python :: how to get RGB value from pixel in screen live python 
Python :: python print int in string with zero padding 
Python :: find max value index in value count pandas 
Python :: limpiar consola en python 
Python :: google colab how to upload a folder 
Python :: binary search tree iterator python 
Python :: django RetrieveUpdateDestroyAPIView 
Python :: set jupyer color to dark 
Python :: remove empty rows csv python 
Python :: username nextcord interactions 
Python :: tkinter input box 
Python :: decode html python 
Python :: pandas dataframe convert string to float 
Python :: simple colours python 
Python :: percentage of null values for every variable in dataframe 
Python :: pandas drop column by name 
Python :: flask_mail 
Python :: hotkey python 
Python :: python tkinter askopenfile 
Python :: unnamed 0 pandas 
Python :: np.array average row 
Python :: get all files in directory python 
Python :: how to veiw and edit files with python 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =