Introduction

In this tutorial, we want to read a CSV file into a Pandas DataFrame. In order to do this, we use the read_csv() function of Pandas.

Import Libraries

First, we import the following python modules:

import pandas as pd

CSV File

We consider the CSV file "frameworks.csv" containing the following data:

We have to keep in mind the following attributes of the CSV file:

  • File includes a header with the column names.
  • Columns of the file are separated with semi-colon ;.
  • File path is "data/frameworks.csv".

Read CSV File into Pandas DataFrame

Next, we would like to read the CSV file into a Pandas DataFrame.

To do this, we use the read_csv() function of Pandas:

df = pd.read_csv("data/frameworks.csv", sep=";")
df

Conclusion

Congratulations! Now you are one step closer to become an AI Expert. You have seen that it is very easy to read a CSV file into a Pandas DataFrame. We can simply use the read_csv() function of Pandas. Try it yourself!

Instagram

Also check out our Instagram page. We appreciate your like or comment. Feel free to share this post with your friends.