問題描述
我很難用 Pandas read_csv<閱讀 SAS JMP 文件/code> 函數(shù)到 Pandas 數(shù)據(jù)幀中.有人對這種類型的數(shù)據(jù)文件有經(jīng)驗嗎?什么是最有效的方法?
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?
推薦答案
這對我有用.它的結(jié)果有時有點出乎意料(例如,有時我得到?jīng)]有標題的 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')
這篇關(guān)于如何使用 Python Pandas 將 JMP *.jmp 文件讀入 Pandas 數(shù)據(jù)幀的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!