In this python dictionary program, we will print the given dictionary in the form of tables.
Steps to solve the program
- Take a dictionary as input.
- Import pandas library.
- Print the given dictionary in the form of tables using Dataframe() from pandas.
import pandas as pd
dict1 = {'names':['virat','messi','kobe'],'sport':['cricket','football','basketball']}
table = pd.DataFrame(dict1)
print(table)
Output :
names sport
0 virat cricket
1 messi football
2 kobe basketball