Learn Before
Concept
pd.read_csv()
pandas.read_csv(filepath, delimiter=None, names=None)
We usually use read_csv() to read a csv file and turn it into dataframe. It is a very useful function. Sometimes we face the problem that the file has not a header and the first line will be the column names of the dataframe. To solve this problem, you can add your expected column names to "names" in the form of names = ['a', 'b', 'c'].
Some times there are rows with exceptional column numbers. For example, 4 are needed but this row have 5. Thus, some error will stop the program. To solve this, you can set [error_bad_lines = False] to drop those lines.
0
1
Updated 2021-01-27
Tags
Data Science