将木地板转换为CSV

编程入门 行业动态 更新时间:2024-10-28 18:32:11
本文介绍了将木地板转换为CSV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如何从本地文件系统(例如python,某些库等)将Parquet转换为CSV,但是没有Spark? (试图找到尽可能简单和极简的解决方案,因为需要使所有内容自动化,并且不需要太多资源).

How to convert Parquet to CSV from a local file system (e.g. python, some library etc.) but WITHOUT Spark? (trying to find as simple and minimalistic solution as possible because need to automate everything and not much resources).

我尝试过在我的Mac上为parquet-tools,但是数据输出看起来不正确.

I tried with e.g. parquet-tools on my Mac but data output did not look correct.

需要进行输出,以便当某些列中不存在数据时-CSV将具有对应的NULL(2个逗号之间的空列)..

Need to make output so that when data is not present in some columns - CSV will have corresponding NULL (empty column between 2 commas)..

谢谢.

推荐答案

您可以使用Python软件包pandas和pyarrow(pyarrow是pandas的可选依赖项,为此,功能).

You can do this by using the Python packages pandas and pyarrow (pyarrow is an optional dependency of pandas that you need for this feature).

import pandas as pd df = pd.read_parquet('filename.parquet') df.to_csv('filename.csv')

当需要修改文件中的内容时,可以在df上进行标准的pandas操作.

When you need to make modifications to the contents in the file, you can standard pandas operations on df.

更多推荐

将木地板转换为CSV

本文发布于:2023-07-08 04:39:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1072055.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   木地板   CSV

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!