Python Pandas - use Multiple Character Delimiter when writing to_csv
问题 It appears that the pandas to_csv function only allows single character delimiters/separators. Is there some way to allow for a string of characters to be used like, "::" or "%%" instead? I tried: df.to_csv(local_file, sep = '::', header=None, index=False) and getting: TypeError: "delimiter" must be a 1-character string 回答1: Use numpy-savetxt Ex: np.savetxt(file.csv, np.char.decode(chunk_data.values.astype(np.bytes_), 'UTF-8'), delimiter='~|', fmt='%s',encoding=None) np.savetxt(file.dat,