Python pandas program to convert a dictionary into DataFrame

In this python pandas program, we will convert a dictionary into DataFrame using pandas library.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create a dictionary.
  3. Now convert that dictionary to  DataFrame using pd.DataFrame().
  4. Print the output.
				
					import pandas as pd
dictionary = {'marks1':[34,20,32,30],'marks2':[36,22,10,44]}
df = pd.DataFrame(dictionary)
print(df)
				
			

Output :

				
					0   marks1  marks2
0      34      36
1      20      22
2      32      10
3      30      44
				
			

find the index of the first occurrence of the smallest and largest value of a series

print the first n rows of a Dataframe

Leave a Comment