KnowledgeBoat Logo
LoginJOIN NOW

Informatics Practices

Which of the following Python statements is used to import data from a CSV file into a Pandas DataFrame (Note: pd is an alias for pandas)?

  1. pd.open_csv('filename.csv')
  2. pd.read_csv('filename.csv')
  3. pd.load_csv('filename.csv')
  4. pd.import_csv('filename.csv')

Python Pandas

2 Likes

Answer

pd.read_csv('filename.csv')

Reason — The statement pd.read_csv('filename.csv') is used to import data from a CSV file into a Pandas DataFrame. The read_csv function reads the contents of the specified CSV file and converts it into a structured DataFrame format.

Answered By

2 Likes


Related Questions