1 Star 0 Fork 0

sam_sun/parquet-python-sqm

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
r.py 1000 Bytes
一键复制 编辑 原始数据 按行查看 历史
sam_sun 提交于 2017-03-23 16:07 . Add test data, r.py
import parquet
import json
import logging
## assuming parquet file with two rows and three columns:
## foo bar baz
## 1 2 3
## 4 5 6
#logging.basicConfig(level=logging.DEBUG)
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename='/tmp/test.log',
filemode='w+')
logger = logging.getLogger("parquet") # pylint: disable=invalid-name
with open("/tmp/tb/000000_0", "rb+") as fo:
# prints:
# {"foo": 1, "bar": 2}
# {"foo": 4, "bar": 5}
#for row in parquet.DictReader(fo, columns=['name']):
#with open("/home/sqm/parquet-python/test-data/nation.dict.parquet") as fo:
for row in parquet.DictReader(fo):
print(json.dumps(row))
'''
with open("test.parquet") as fo:
# prints:
# 1,2
# 4,5
for row in parquet.reader(fo, columns=['foo', 'bar]):
print(",".join([str(r) for r in row]))
'''
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/sqm2050/parquet-python-sqm.git
git@gitee.com:sqm2050/parquet-python-sqm.git
sqm2050
parquet-python-sqm
parquet-python-sqm
read

搜索帮助