Print the given dictionary in the form of tables.

In this python dictionary program, we will print the given dictionary in the form of tables.

Steps to solve the program
  1. Take a dictionary as input.
  2. Import pandas library.
  3. 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
				
			

create a dictionary from a string.

count frequencies in a list using a dictionary.

Leave a Comment