json - pandas 将数据帧写入 to_json 方法替代
问题描述
我正在使用这个每小时处理大约 400 万行和 50 列的数据框:
#Write out the file
try:
display('Writing {0} '.format(filename))
df_full.to_json('{0}{1}'.format(output_path,filename),orient='records',lines=True )
except Exception as e :
logging.error("Error could not write file", exc_info=True)
print("Error could not write file")
我这样做是为了简单,但它太慢了。它看起来不像任何 IO 瓶颈,但我必须写出 json,因为它被送入另一个系统进行拾取/摄取。什么是更快的替代方法?
解决方案
推荐阅读
- reactjs - React:当类的状态改变时防止自动刷新
- python - 我可以在 python 中使用 444RGB 或 555RGB 吗?
- logstash - 如何在logstash中转换格式“yyyy-MM-dd HH:mm:ss
- java - Selenium 动作多线程
- javascript - react + firebase 加载数据问题
- javascript - 如何使用 jQuery 追加数组?
- html - 如何在图标和文本之间留出更多空间?
- angular - Typescript 构造函数 - 忽略目标上不存在的字段
- c# - 使用预热 C# 的准备状态健康检查
- spring-boot - 使用自定义 UID/GID 构建 spring-boot OCI 映像