How to Append a Python Dictionary to a Pandas DataFrame

If you want to append a Python dictionary to a Pandas DataFrame, you can do this:

# Create a new DataFrame output = pd.DataFrame() # Append the dictionary by ignoring the index output = output.append(dictionary, ignore_index=True) # View the new DataFrame print(output.head())
Code language: Python (python)

Notice the reassignment output = output.append(...)

Tags:
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments