https://app.dataquest.io/m/290/boolean-indexing-with-numpy/2/reading-csv-files-with-numpy-continued
import nyc_taxi.csv as a list of lists
f = open("nyc_taxis.csv", "r")
taxi_list = list(csv.reader(f))
Can anyone please explain what does r
stand for in the import statement.
Rucha
April 5, 2020, 6:27am
#2
hey @anisha.seeniraj
Welcome to DQ community!
the “r” stands for Read
this is the default option for open
function. it opens a file for reading, and will throw an error if the file does not exists (at the specified location).
1 Like
So, we use READ in open function and also csv.reader() to again read the file?
Rucha
April 6, 2020, 3:00am
#4
hey @anisha.seeniraj
We are opening the file for reading in the open function and we are reading the file using the reader object.
to read the opened file we are passing the opened file object to csv.reader(f)
1 Like