I found this error, the cause was that there were some carriage returns “\r” in the data that pandas was using as a line terminator as if it was “\n”. I thought I’d post here as that might be a common reason this error might come up.
The solution I found was to add lineterminator=’\n’ into the read_csv function like this:
df_clean = pd.read_csv('test_error.csv', lineterminator='\n')
Related Posts:
- Writing a pandas DataFrame to CSV file
- Writing a pandas DataFrame to CSV file
- Pandas: ValueError: cannot convert float NaN to integer
- How to load a tsv file into a Pandas DataFrame?
- OSError: Initializing from file failed on csv in Pandas
- How to add pandas data to an existing csv file?
- TypeError: list indices must be integers or slices, not str
- Renaming column names in Pandas
- How to deal with SettingWithCopyWarning in Pandas
- How to deal with SettingWithCopyWarning in Pandas
- How to iterate over rows in a DataFrame in Pandas
- Adding new column to existing DataFrame in Python pandas
- ImportError: No module named pandas
- How to change the order of DataFrame columns?
- ImportError: No module named pandas. Pandas installed pip
- How can I use the apply() function for a single column?
- Convenient way to deal with ValueError: cannot reindex from a duplicate axis
- How to fix IndexError: invalid index to scalar variable
- “Series objects are mutable and cannot be hashed” error
- Merging dataframes on index with pandas
- Convert Python dict into a dataframe
- re.sub erroring with “Expected string or bytes-like object”
- How do I select rows from a DataFrame based on column values?
- How do I select rows from a DataFrame based on column values?
- DataFrame constructor not properly called! error
- Pandas group-by and sum
- How do I get the row count of a Pandas DataFrame?
- Python pandas groupby aggregate on multiple columns, then pivot
- Convert pandas dataframe to NumPy array
- Error:cannot convert float NaN to integer in pandas
- Replacing column values in a pandas DataFrame
- How do I get the row count of a Pandas DataFrame?
- Python Pandas – Missing required dependencies [‘numpy’] 1
- Get list from pandas dataframe column or row?
- pandas DataFrame “no numeric data to plot” error
- ‘DataFrame’ object has no attribute ‘sort’
- Rename Pandas DataFrame Index
- pandas: filter rows of DataFrame with operator chaining
- Convert DataFrame column type from string to datetime, dd/mm/yyyy format
- Pandas how to use pd.cut()
- How to Read .txt in Pandas
- Get a list from Pandas DataFrame column headers
- Get total of Pandas column
- Type error: cannot convert the series to
- How to check whether a pandas DataFrame is empty?
- Convert columns to string in Pandas
- Change column type in pandas
- Shuffle DataFrame rows
- Dump a NumPy array into a csv file
- Python: pandas merge multiple dataframes
- How to count the NaN values in a column in pandas DataFrame
- How to iterate over columns of pandas dataframe to run regression
- JSON to pandas DataFrame
- Create a .csv file with values from a Python list
- Converting between datetime and Pandas Timestamp objects
- Pandas – DataFrame object is not callable
- Creating a Pandas DataFrame from a Numpy array: How do I specify the index column and column headers?
- Convert pandas data frame to series
- Converting strings to floats in a DataFrame
- Get first row value of a given column
- Selecting/excluding sets of columns in pandas
- How to add title to seaborn boxplot
- How to filter Pandas dataframe using ‘in’ and ‘not in’ like in SQL
- How to add an empty column to a dataframe?
- Deleting DataFrame row in Pandas based on column value
- How to apply a function to two columns of Pandas dataframe
- Pandas long to wide reshape, by two variables
- Convert categorical data in pandas dataframe
- pandas create new column based on values from other columns / apply a function of multiple columns, row-wise
- SettingWithCopyWarning even when using .loc[row_indexer,col_indexer] = value
- AttributeError: Can only use .str accessor with string values, which use np.object_ dtype in pandas
- Insert a row to pandas dataframe
- Python Pandas ValueError Arrays Must be All Same Length
- How to save a Seaborn plot into a file
- Subtract two columns in dataframe
- pandas DataFrame: replace nan values with average of columns
- Plot correlation matrix using pandas
- Pandas error “Can only use .str accessor with string values”
- Plotting multiple lines, in different colors, with pandas dataframe
- Rename specific column(s) in pandas
- ImportError: No module named ‘xlrd’
- How to convert column with dtype as object to string in Pandas Dataframe
- Moving Average Pandas
- Python CSV Error: sequence expected
- Pandas: sum up multiple columns into one column without last column
- python pandas remove duplicate columns
- matplotlib: plot multiple columns of pandas data frame on the bar chart
- _csv.Error: field larger than field limit (131072)
- Concat DataFrame Reindexing only valid with uniquely valued Index objects
- Move column by name to front of table in pandas
- Pandas unstack problems: ValueError: Index contains duplicate entries, cannot reshape
- Python: Convert timedelta to int in a dataframe
- Calculate weighted average using a pandas/dataframe
- Got continuous is not supported error in RandomForestRegressor
- ValueError: multiclass format is not supported
- How to convert .sav file into csv file
- ValueError: Must pass DataFrame with boolean values only
- Extracting specific selected columns to new DataFrame as a copy
- How to read a CSV file from a URL with Python?
- How to import a csv-file into a data array?