Tuesday, January 20, 2026
HomeLanguagesConvert CSV to Pandas Dataframe

Convert CSV to Pandas Dataframe

In this article, we will discuss how to convert CSV to Pandas Dataframe, this operation can be performed using pandas.read_csv reads a comma-separated values (csv) file into DataFrame.

Example 1: In the below program we are going to convert nba.csv into a data frame and then display it.

Python




# import pandas moduleĀ 
import pandas as pdĀ 
Ā Ā Ā Ā 
# making dataframeĀ 
df = pd.read_csv("nba.csv")Ā 
Ā Ā Ā 
# output the dataframe
print(df)


Output:

Example 2: Here is another example to convert a CSV dataset into pandas data frame.Ā 

Python




# import pandas moduleĀ 
import pandas as pdĀ 
Ā Ā Ā Ā 
# making dataframeĀ 
df = pd.read_csv("nba.csv")Ā 
Ā Ā Ā 
# output the dataframe
print(df)


Output:

RELATED ARTICLES

Most Popular

Dominic
32474 POSTS0 COMMENTS
Milvus
118 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS