模拟:https://creativedata.atlassian.net/wiki/spaces/SAP/pages/61177860/Python+-+Read+Write+files+from+HDFS

import pandas as pd
from hdfs import InsecureClient
import os

client_hdfs = InsecureClient('http://(your name node ip adress):50070/',user='hadoop')
# Creating a simple Pandas DataFrame
liste_hello = ['hello1','hello2']
liste_world = ['world1','world2']
df = pd.DataFrame(data = {'hello' : liste_hello, 'world': liste_world})
 
# Writing Dataframe to hdfs
with client_hdfs.write('/Learn/input/helloworld.csv', encoding = 'utf-8') as writer:
    df.to_csv(writer)

python--upload file into HDFS 加载文件到HDFS

 

相关文章:

  • 2021-09-27
  • 2022-02-09
  • 2021-12-31
  • 2021-08-26
  • 2022-12-23
  • 2021-10-25
  • 2021-05-28
  • 2021-05-13
猜你喜欢
  • 2022-02-09
  • 2022-12-23
  • 2022-01-28
  • 2021-12-07
  • 2022-12-23
  • 2022-01-06
  • 2022-02-09
相关资源
相似解决方案