mirror of
https://github.com/modelscope/modelscope.git
synced 2026-02-24 12:10:09 +01:00
add escapechar for dataframe to_csv func
This commit is contained in:
@@ -774,7 +774,11 @@ class HubApi:
|
||||
else:
|
||||
with_header = False
|
||||
chunk_df = pd.DataFrame(chunk)
|
||||
chunk_df.to_csv(f, index=False, header=with_header)
|
||||
try:
|
||||
chunk_df.to_csv(f, index=False, header=with_header)
|
||||
except Exception as e:
|
||||
logger.info(f'Failed to dump dataframe chunk to csv: {e}, try to set escapechar')
|
||||
chunk_df.to_csv(f, index=False, header=with_header, escapechar='\\')
|
||||
iter_num += 1
|
||||
else:
|
||||
# csv or others
|
||||
|
||||
Reference in New Issue
Block a user