Skip to main content

bpd.read_csv()

bpd.read_csv(filepath)

Reads a CSV (comma-separated values) file into a DataFrame.

Input:
filepath : string, path object, file-like object.
This should give a path to the CSV relative to the location of the notebook, or a URL that points to a CSV file. This must be a string, so don't forget to use quotes.
Returns:
df - DataFrame with the contents of the CSV file.
Return Type:
DataFrame

pets = bpd.read_csv('pets.csv')
pets
IndexIDSpeciesColorWeightAgeIs_CatOwner_Comment
0dog_001dogblack405False There are no bad dogs, only bad owners.
1cat_001catgolden1.50.2TrueMy best birthday present ever!!!
2cat_002catblack159True****All you need is love and a cat.****
3dog_002dogwhite802FalseLove is a wet nose and a wagging tail.
4dog_003dogblack250.5FalseBe the person your dog thinks you are.
5ham_001hamsterblack13FalseNo, thank you!
6ham_002hamstergolden0.250.2FalseNo, thank you!
7cat_003catblack100TrueNo, thank you!