942295_de-DE
JMP 19 Python-Integration: ValueError: Jahr 0 beim Konvertieren einer Datentabelle in Pandas
Hallo zusammen,
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">
Fragen:
- Wie konvertiert man in JMP 19 offiziell eine geöffnete Datentabelle in einen 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.
- Wie sollten „Jahr 0“- oder JMP-Null-Datumsangaben (1904-Epoche) in JMP 19 behandelt werden, um Python-Datums- und Zeitabstürze zu vermeiden?
</CODE>
</DIV>
</DIV>
</LINGO-BODY>
<LINGO-LABS id="lingo-labs-942295" slang="en-US" mode="CREATE">
<LINGO-LABEL>Automatisierung und Skripterstellung</LINGO-LABEL>
<LINGO-LABEL>Datenzugriff</LINGO-LABEL>
<LINGO-LABEL>Datenexploration und -visualisierung</LINGO-LABEL>
<LINGO-LABEL>Qualitäts- und Prozessentwicklung</LINGO-LABEL>
</LINGO-LABS>
<LINGO-SUB id="lingo-sub-942305" slang="en-US" mode="CREATE" translate="no">Betreff: JMP 19 Python-Integration: ValueError: Jahr 0 beim Konvertieren einer Datentabelle in Pandas</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">Die Weiterentwicklung von Python in JMP 19</A> ist höchstwahrscheinlich ein guter Ausgangspunkt.</P>
</LINGO-BODY>
<LINGO-SUB id="lingo-sub-943465" slang="en-US" mode="CREATE" translate="no">Betreff: JMP 19 Python-Integration: ValueError: Jahr 0 beim Konvertieren einer Datentabelle in Pandas</LINGO-SUB>
<LINGO-BODY id="lingo-body-943465" slang="en-US" mode="CREATE">
<P>Aktuelle Informationen zur API des <STRONG>Import-JMP-</STRONG> Objekts finden Sie im JMP-Skriptindex unter der Kategorie „Python“. Dokumentation und Beispielcode enthalten die neuesten Aktualisierungen. Das JMP-Modul wurde in Version 19 umfassend aktualisiert.</P>
<P>Angesichts Ihrer Funktion würde ich sagen, dass Pandas den ValueError auslöst. Pandas hat sich zwischen der in JMP 18 verwendeten Python-Version 3.11 und der in JMP 19 verwendeten Python-Version 3.13 geändert.</P>
<P>Siehe das Beispiel im Index „Skripting“ unter `jmp.DataTable.from_dataframe()`. Dort finden Sie zahlreiche Beispiele für den Datenaustausch mit JMP-Datentabellen und anderen Dataframe-kompatiblen Python-Objekten: Pandas, Polars, Ibis usw.</P>
<P>Konkret geht es um Beispiele für die Konvertierung von Pandas zu JMP und von JMP zu Pandas.</P>
<P>JMP zu Pandas Beispiel:</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