Create Pandas DataFrame

  • Post category:Pandas

In this Pandas tutorial, you will learn how to create Pandas DataFrame. You can make a DataFrame in Pandas with the following code.

# import Pandas library
import pandas as pd

# create a dataframe
var = pd.DataFrame({'A': [11, 12, 13, 14, 15], 'B': [6, 7, 8, 9, 10], 'C': [31, 2, 3, 14, 15]})

# display the dataframe
print(var)

Output:

    A   B   C
0  11   6  31
1  12   7   2
2  13   8   3
3  14   9  14
4  15  10  15

Free resources to learn advanced skills: AiHints and CodeAllow