如何使用Python Pandas将JMP * .jmp文件读入Pandas数据框 [英] How to read JMP *.jmp file with Python Pandas into Pandas dataframe

查看:416
本文介绍了如何使用Python Pandas将JMP * .jmp文件读入Pandas数据框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正努力使用 SAS JMP文件 > read_csv 函数导入Pandas数据框。有没有人对这种类型的数据文件有经验?最有效的方法是什么?

I am struggling to read SAS JMP files with Pandas read_csv function into Pandas dataframe. Does anyone have experience with this type of data file? What is the most efficient way?

推荐答案

这对我有用。它的结果有时会有些出乎意料(例如,有时我会得到不带标题的CSV,即使在JMP中它们也有)。
不幸的是,您需要安装SAS JMP,并且此解决方案仅适用于Windows。

This has worked for me. Its results are sometimes a bit unexpected (for example, sometimes I get CSVs without headers, even though in JMP they have them). Unfortunately, you need to have SAS JMP installed and this solution only works on Windows.

import pandas as pd
from win32com.client import Dispatch

jmp = Dispatch("JMP.Application")
doc = jmp.OpenDocument('sasjmpfile.jmp')
doc.SaveAs('sasjmpfile.csv')

df = pd.read_csv('sasjmpfile.csv')

这篇关于如何使用Python Pandas将JMP * .jmp文件读入Pandas数据框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆