Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
software_development:python_pandas [2022/08/04 15:11] prgram [Selects] |
software_development:python_pandas [2023/05/16 15:09] prgram [encoding_errors - 'ignore'] |
||
---|---|---|---|
Line 123: | Line 123: | ||
| | ||
=====I/O file===== | =====I/O file===== | ||
+ | |||
+ | === encoding_errors - 'ignore'=== | ||
+ | Encoding 제대로 했는데도 안되면.. | ||
+ | 공공데이터가 이런 경우가 많음. | ||
+ | |||
+ | <code python> | ||
+ | import chardet | ||
+ | with open(file, 'rb') as rawdata: | ||
+ | result = chardet.detect(rawdata.read(100000)) | ||
+ | result | ||
+ | |||
+ | |||
+ | data = pd.read_csv( file, encoding='cp949', encoding_errors='ignore') | ||
+ | # on_bad_lines='skip' | ||
+ | # error_bad_lines=False | ||
+ | </code> | ||
=== to_numberic === | === to_numberic === |