Problem Description:
error when loading CSV format data in pandas
B = pd.read_csv("C:/Users/hp/Desktop/Hands-On Data Analysis/Unit 1 Project Collection/train.csv")
B.head(3)
report errors:
OSError: Initializing from file failed
Cause analysis:
When calling the read_csv() method of pandas, the C engine is used as the parser engine by default, and when the file name contains Chinese, using the C engine will be wrong in some cases.
Solution:
Specify the engine as Python when calling the read_csv() method
B = pd.read_csv("C:/Users/hp/Desktop/Hands-On-Data-Analysis/Unit-1-Project-Collection/train.csv",engine='python')
B.head(3)
Read More:
- [Solved] Python Read bam File Error: &&OSError: no BGZF EOF marker; file may be truncated
- Error reading file by pandas pandas.errors.EmptyDataError: no columns to parse from file
- Pandas read_csv pandas.errors.ParserError: Error tokenizing data
- How to Solve Python Pandas Read or Import Files Error
- Python Error: OSError: cannot open resource [How to Solve]
- Python Pandas Typeerror: invalid type comparison
- Python: How to Reshape the data in Pandas DataFrame
- Python+ Pandas + Evaluation of Music Equipment over the years (Notes)
- OSError libespeak.so.1 error: no such file or directory [How to Solve]
- Python Pandas Error: KeyError: 0 [How to Solve]
- Mac Upgrade pip Error OSError: [Errno 13] Permission denied: ‘/Library/Python/2.7/site-packages/pip-9.0.1-py2….
- Python opens the table and appears pandas.errors.ParserError: Error tokenizing data. C error:
- Pandas Read csv Error tokenizing data. C error: Expected 18 fields in line 173315, saw 20
- Python Pandas Error: No module named ‘openpyxl‘
- OSError: [WinError 1455] The page file is too small to complete the operation. Error loading…
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- Python failed to import pyx file [How to Solve]
- [Solved] opencv-python: recipe for target ‘modules/python3/CMakeFiles/opencv_python3.dir/all‘ failed
- [Solved] AttributeError: module ‘pandas‘ has no attribute ‘rolling_count‘
- [How to Fix]pandas.errors.ParserError: Error tokenizing data