Reading / Writing a CSV

This quiz covers how to read/write a .csv file/dataset in Pandas.

Reading/writing .csv files

1

Assuming there are bad lines (e.g., too many commas in a line) in a csv file, how can you skip them from being read in your DataFrame, without throwing an error?

A)

df = pd.read_csv('f.csv', warn_bad_lines=True)

B)

df = pd.read_csv('f.csv', error_bad_lines=True)

C)

df = pd.read_csv('f.csv')

df = df.dropna()

Question 1 of 30 attempted

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.