save df to txt
df.to_csv(r'c:datapandas.txt', header=None, index=None, sep='t', mode='a')
save df to txt
df.to_csv(r'c:datapandas.txt', header=None, index=None, sep='t', mode='a')
dataframe to txt
df.to_csv(r'c:datapandas.txt', header=None, index=None, sep=' ', mode='a')
convert a text file data to dataframe in python without pandas
import csv
with open('log.txt', 'r') as in_file:
stripped = (line.strip() for line in in_file)
lines = (line.split(",") for line in stripped if line)
with open('log.csv', 'w') as out_file:
writer = csv.writer(out_file)
writer.writerow(('title', 'intro'))
writer.writerows(lines)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us