Importeer CSV naar Dataframe
import pandasfactuurlines = pd.read_csv("df_debet_geschoond.csv",sep=";",engine='python' )
toelichting engine=python
“Error tokenising data. C error: EOF inside string starting at line”.
There was an erroneous character about 5000 lines into the CSV file that prevented the Pandas CSV parser from reading the entire file. Excel had no problems opening the file, and no amount of saving/re-saving/changing encodings was working. Manually removing the offending line worked, but ultimately, another character 6000 lines further into the file caused the same issue.
The solution was to use the parameter engine=’python’ in the read_csv function call. The Pandas CSV parser can use two different “engines” to parse CSV file – Python or C (default).
Geen opmerkingen:
Een reactie posten