一、写入操作
import hdfs
import pandas as pd
path = 'test.txt'
df = pd.DataFrame(data=[[1,2,3],[4,5,6],[7,8,9]],columns=list('abc'))
client = hdfs.InsecureClient('host:50070',user='admin')
client.write(path,df.to_csv(header = False,index = False,sep='\t'),
encoding = 'utf-8',overwrite = True)
网友评论