简体   繁体   中英

python dask to_csv delimiter

I have a question to setup delimiter with python dask .

import dask.dataframe as dd

df_out.to_csv("path/out.csv", single_file = True)

How can I set a delimiter ? It seems that there is no parameter for delimiter.

I got the error:
FileNotFoundError: [Errno 2] No such file or directory: '/folderpathg/out.csv/005.part'

You can pass sep option:

import pandas as pd
df = pd.DataFrame(zip(range(10), range(10)), columns=list('ab'))

import dask.dataframe as dd
ddf = dd.from_pandas(df, npartitions=3)

ddf.to_csv('test.txt', sep='|', single_file=True, index=False)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM