python--upload file into HDFS 加载文件到HDFS
2024-08-25 17:45:46
模拟: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)
最新文章
- TestNG插件的安装问题
- [nRF51822] 3、 新年也来个总结——图解nRF51 SDK中的Button handling library和FIFO library
- 数据结构:C_顺序栈的实现
- 【mysql创建用户|删除用户|修改用户权限|常用命令】
- C# 常用加密处理
- OpenJudge计算概论-称体重【枚举法、信息数字化】
- Android SlidingMenu开源库及其使用
- Git和Github的应用与命令方法总结
- .net开发框架设计
- 301跳转:IIS服务器网站整站301永久重定向设置方法(阿里云)
- Maven的安装环境配置
- 【集训第三天·疯狂训练】哦,顺带学习了manacher
- MacTalk·人生元编程 - 读书笔记
- C++对象生存期&;&;static
- jenkins的sbt插件安装
- NFS存储服务
- go在ubuntu下安装
- Learning-MySQL【3】:数据类型和运算符
- angularJs中$controller的使用
- CentOS忘记root密码解决办法