942295_ko-KR
JMP 19 Python 통합: 데이터 테이블을 Pandas로 변환할 때 ValueError: year 0 오류가 발생합니다.
여러분, 안녕하세요,
I am upgrading my scripts from JMP18 to JMP19 and 'm hitting a particular roadblock with this integration. In JMP 18, I used custom function to loop through columns and create Pandas DataFrame. It worked perfectly. However in JMP19, the exact code throws a
ValueError: year 0 is out of range.
Here is the snippet:
Python Send("raw_data");
</CODE>
</DIV>
<DIV class="Y3BBE" data-sfc-cp="" data-sfc-root="c" data-sfc-cb="" data-hveid="CAEIBRAA" data-complete="true" data-processed="true">
<PRE>def jmp_to_pandas(jmp_table):
cols = list(jmp_table)
data_dict = {}
for col in cols:
data_dict[col.name] = list(col)
return pd.DataFrame(data_dict)
</PRE>
<CODE class="KDcb0c" dir="ltr" data-sae="" data-complete="true" data-sfc-cb="" data-sfc-root="c">data1 = jmp_to_pandas(raw_data)
</CODE>
</DIV>
<DIV class="Y3BBE" data-sfc-cp="" data-sfc-root="c" data-sfc-cb="" data-hveid="CAEIBRAA" data-complete="true" data-processed="true">
<CODE class="KDcb0c" dir="ltr" data-sae="" data-complete="true" data-sfc-cb="" data-sfc-root="c">
질문:
- JMP 19에서 열려 있는 데이터 테이블을 Pandas DataFrame으로 변환하는 공식적인 방법은 무엇입니까?
- Has the
jmp module structure changed? I'm finding it difficult to locate the updated JMP 19 Python API reference on the website.
- JMP 19에서 Python의 datetime 함수 충돌을 방지하려면 "0년" 또는 JMP null 날짜(1904년)를 어떻게 처리해야 할까요?
</CODE>
</DIV>
</DIV>
</LINGO-BODY>
<LINGO-LABS id="lingo-labs-942295" slang="en-US" mode="CREATE">
<LINGO-LABEL>자동화 및 스크립팅</LINGO-LABEL>
<LINGO-LABEL>데이터 접근</LINGO-LABEL>
<LINGO-LABEL>데이터 탐색 및 시각화</LINGO-LABEL>
<LINGO-LABEL>품질 및 공정 엔지니어링</LINGO-LABEL>
</LINGO-LABS>
<LINGO-SUB id="lingo-sub-942305" slang="en-US" mode="CREATE" translate="no">제목: JMP 19 Python 통합 관련: 데이터 테이블을 Pandas로 변환할 때 ValueError: year 0 오류 발생</LINGO-SUB>
<LINGO-BODY id="lingo-body-942305" slang="en-US" mode="CREATE">
<P><A href="https://community.jmp.com/t5/JMPer-Cable/Going-further-with-Python-in-JMP-19/m-p/898522#U898522" class="lia-mention-container-editor-message lia-img-icon-blog-thread lia-fa-icon lia-fa-blog lia-fa-thread lia-fa" target="_blank">JMP 19에서 파이썬을 더 심도 있게 공부하는 것이</A> 좋은 출발점이 될 가능성이 높습니다.</P>
</LINGO-BODY>
<LINGO-SUB id="lingo-sub-943465" slang="en-US" mode="CREATE" translate="no">제목: JMP 19 Python 통합 관련: 데이터 테이블을 Pandas로 변환할 때 ValueError: year 0 오류 발생</LINGO-SUB>
<LINGO-BODY id="lingo-body-943465" slang="en-US" mode="CREATE">
<P><STRONG>jmp 객체의 API 가져오기</STRONG> 에 대한 최신 정보는 JMP의 스크립팅 색인 'Python' 범주를 참조하십시오. 문서와 샘플 코드는 최신 업데이트를 제공합니다. jmp 모듈은 19 버전에서 중요한 업데이트가 이루어졌습니다.</P>
<P>제시하신 함수를 보면 Pandas에서 ValueError가 발생하는 것 같습니다. JMP 18에서 사용된 Python 3.11 버전과 JMP 19에서 사용된 Python 3.13 버전 사이에 Pandas가 변경되었습니다.</P>
<P>jmp.DataTable.from_dataframe()의 스크립팅 색인 예제를 참조하세요. JMP 데이터 테이블과 Pandas, Polars, Ibis 등 다른 데이터프레임 호환 Python 객체 간의 변환 예제가 여러 개 있습니다.</P>
<P>구체적으로는 'Pandas에서 JMP로' 및 'JMP에서 Pandas로' 예제입니다.</P>
<P>JMP에서 Pandas로의 변환 예시:</P>
<PRE class="lia-code-sample language-python"><CODE>import jmp
import jmputils
try:
if not jmputils.is_installed('pandas'):
jmputils.jpip('install', 'pandas', echo=False)
except Exception as e:
print(f'Install failed with exception: {e}')
import pandas as pd
dt = jmp.open(jmp.SAMPLE_DATA + "Big Class.jmp")
pandas_df = (pd.api.interchange.from_dataframe(dt))
print(pandas_df)
Comments
There are no comments yet