<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910650#M106976</link>
    <description>&lt;P&gt;In JMP 18 it was necessary to build up a data table column by column from a data frame. &amp;nbsp;JMP 19 supports the portable data frame protocol, so it is 1 line of code to go from a dt -&amp;gt; df, and 1 line of code to go df -&amp;gt; dt in memory.&lt;/P&gt;
&lt;P&gt;Also understand that the very first time a Python script is run in JMP, Python itself needs to be initialized. &amp;nbsp;First time you import a package it needs to be loaded, possibly including shared libraries or byte code compilation of the .py files.&lt;/P&gt;
&lt;P&gt;The warning is coming from the pandas package. &amp;nbsp;To clear the warning you need to do their suggested ser.iloc[pos]. &amp;nbsp;The JMP data table dt can be indexed by 0-based column index or by column name. &amp;nbsp;Index would be faster since it would avoid string comparisons.&lt;/P&gt;
&lt;P&gt;Help -&amp;gt; Scripting Index &amp;nbsp; 'Python' &amp;nbsp;category, &amp;nbsp; jmp.from_dataframe. &amp;nbsp;'JMP to Pandas' example.&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;SPAN&gt;import jmp&lt;BR /&gt;import jmputils&lt;BR /&gt;&lt;BR /&gt;try:&lt;BR /&gt;    if not jmputils.is_installed('pandas'):&lt;BR /&gt;        jmputils.jpip('install', 'pandas', echo=False)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;    print(f'Install failed with exception: {e}')&lt;BR /&gt;&lt;BR /&gt;import pandas as pd&lt;BR /&gt;&lt;BR /&gt;dt = jmp.open(jmp.SAMPLE_DATA + "Big Class.jmp")&lt;BR /&gt;pandas_df = (pd.api.interchange.from_dataframe(dt))&lt;BR /&gt;print(pandas_df)&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;# new dt_result data table from dataframe df_result&lt;BR /&gt;dt_result = jmp.from_dataframe( df_result ) &lt;BR /&gt;&lt;BR /&gt;# or continue to do the loop on columns if you need to update the original data table from the resulting dataframe.&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
    <pubDate>Thu, 30 Oct 2025 20:00:30 GMT</pubDate>
    <dc:creator>Paul_Nelson</dc:creator>
    <dc:date>2025-10-30T20:00:30Z</dc:date>
    <item>
      <title>Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910626#M106973</link>
      <description>&lt;P&gt;Background&lt;/P&gt;
&lt;P&gt;* Using Python in JMP19 scripting environment.&lt;/P&gt;
&lt;P&gt;* Creating dataframe (df) from pandas from existing JMP datatable (dt).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Running function that requires df input and returns a new df result.&amp;nbsp; Lets call it df_results.&lt;/P&gt;
&lt;P&gt;* Transferring results back to JMP datatable column.&lt;/P&gt;
&lt;P&gt;This works, but there are two things that make me suspect I'm not doing this properly.&amp;nbsp; For one, I get a warning in the local log output.&amp;nbsp; And two, the first time I run this on a very large number of rows it takes a long time.&amp;nbsp; My code timer said 25 seconds for 100k rows.&amp;nbsp; If I rerun it, the second time it takes 3 seconds.&amp;nbsp; I set up the timer to give me details on each step so I could find out if one line of code was taking most of the time.&lt;/P&gt;
&lt;P&gt;This is the single line of code I'm questioning.&amp;nbsp; Took 25 seconds for 100k rows ONLY the first time the initially constant (or null - tried both) column was filled out.&amp;nbsp; Then almost 10x faster every subsequent rerun after that.&lt;/P&gt;
&lt;P&gt;dt[ColumnName] = df_results[ColumnName]&lt;/P&gt;
&lt;P&gt;This is the warning message in the embedded log&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Also, I did this for 4 different columns total from 2 different dataframes.&amp;nbsp; They all exhibited the same behavior (and warning).&amp;nbsp; Slow first run.&amp;nbsp; Fast every repeat.&amp;nbsp; Negligible difference between Column 1 , 2, 3 or 4.&lt;/P&gt;
&lt;P&gt;This is only a subset of a large table with 1.3 million rows.&amp;nbsp; So, 25 seconds x 4 columns will become 250+ seconds x 4 columns if I can't figure out how to get the faster speeds on the first try.&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2025 19:09:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910626#M106973</guid>
      <dc:creator>MeanChris</dc:creator>
      <dc:date>2025-10-30T19:09:22Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910650#M106976</link>
      <description>&lt;P&gt;In JMP 18 it was necessary to build up a data table column by column from a data frame. &amp;nbsp;JMP 19 supports the portable data frame protocol, so it is 1 line of code to go from a dt -&amp;gt; df, and 1 line of code to go df -&amp;gt; dt in memory.&lt;/P&gt;
&lt;P&gt;Also understand that the very first time a Python script is run in JMP, Python itself needs to be initialized. &amp;nbsp;First time you import a package it needs to be loaded, possibly including shared libraries or byte code compilation of the .py files.&lt;/P&gt;
&lt;P&gt;The warning is coming from the pandas package. &amp;nbsp;To clear the warning you need to do their suggested ser.iloc[pos]. &amp;nbsp;The JMP data table dt can be indexed by 0-based column index or by column name. &amp;nbsp;Index would be faster since it would avoid string comparisons.&lt;/P&gt;
&lt;P&gt;Help -&amp;gt; Scripting Index &amp;nbsp; 'Python' &amp;nbsp;category, &amp;nbsp; jmp.from_dataframe. &amp;nbsp;'JMP to Pandas' example.&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;SPAN&gt;import jmp&lt;BR /&gt;import jmputils&lt;BR /&gt;&lt;BR /&gt;try:&lt;BR /&gt;    if not jmputils.is_installed('pandas'):&lt;BR /&gt;        jmputils.jpip('install', 'pandas', echo=False)&lt;BR /&gt;except Exception as e:&lt;BR /&gt;    print(f'Install failed with exception: {e}')&lt;BR /&gt;&lt;BR /&gt;import pandas as pd&lt;BR /&gt;&lt;BR /&gt;dt = jmp.open(jmp.SAMPLE_DATA + "Big Class.jmp")&lt;BR /&gt;pandas_df = (pd.api.interchange.from_dataframe(dt))&lt;BR /&gt;print(pandas_df)&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;# new dt_result data table from dataframe df_result&lt;BR /&gt;dt_result = jmp.from_dataframe( df_result ) &lt;BR /&gt;&lt;BR /&gt;# or continue to do the loop on columns if you need to update the original data table from the resulting dataframe.&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 30 Oct 2025 20:00:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910650#M106976</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-10-30T20:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910652#M106977</link>
      <description>&lt;P&gt;&lt;STRONG&gt;And what is the fastest way to fill a single JMP column with new values from Python?&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;e.g. for a data table with 100k rows?&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 20:12:39 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910652#M106977</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-04T20:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910653#M106978</link>
      <description>&lt;P&gt;Thanks Paul, I will implement the jmp.from_dataframe to get back to datatables to avoid the error.&lt;/P&gt;
&lt;P&gt;The other part of my question was about why there was such a huge speed difference, and in order to answer that I had to ensure I could reliably cause the SLOW calculation response.&amp;nbsp; At first I couldn't.&amp;nbsp; All runs, even the first after opening JMP and loading Python were plenty fast.&amp;nbsp; Then I realized there may be one critical difference.&amp;nbsp; If I ADD a new column (manually, hadn't put it in code yet) and run the code it will ONLY be slow updating that new column and ONLY for the first time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a test I updated 4 columns, with 3 being pre-existing and the 4th being newly created.&amp;nbsp; It took 1 sec to update 100k rows of Col 1, another second to update Col 2, another to update Col 3, and then 19 seconds to update Col 4.&lt;/P&gt;
&lt;P&gt;I made another table and another 'new' 4th column.&amp;nbsp; If I SAVE AND CLOSE the datatable with the new column,, then REOPEN, then run the code... the new 4th column updates in ~ 1 second, just as fast as ##1, 2 and 3&amp;nbsp; Critically, if I only save, but do NOT CLOSE &amp;amp; REOPEN the datatable with the new 4th column, then run the code, it will still take the longer ~ 19 seconds to update column 4.&lt;/P&gt;
&lt;P&gt;This tells me the speed has to do with some memory management quirk of JMP.&lt;/P&gt;
&lt;P&gt;I don't know if this is a problem that can/must be solved, and maybe it still is only a problem if I don't use the 'from_dataframe' step.&amp;nbsp; Just very odd behavior that I'm glad I was able to recreate.&amp;nbsp; Now I can try the better version of the code and see if the issue persists.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Oct 2025 21:46:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910653#M106978</guid>
      <dc:creator>MeanChris</dc:creator>
      <dc:date>2025-10-30T21:46:09Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910686#M106980</link>
      <description>&lt;P&gt;One of my colleagues pointed out in JSL there is the Start Data Update and End Data Update, so....&lt;/P&gt;
&lt;PRE&gt;jmp.run_jsl( 'dt &amp;lt;&amp;lt; Begin Data Update;' )

# your python code filling new column
...

jmp.run_jsl( 'dt &amp;lt;&amp;lt; End Data Update;' )
&lt;/PRE&gt;
&lt;P&gt;Most likely we will want to do support this from Python. Probably using a with block to suspend the UI updates of the table when filling / updating large number of rows.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 03:01:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910686#M106980</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-10-31T03:01:47Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910687#M106981</link>
      <description>&lt;P&gt;It would be setting the entire column using the dt[index] wrapped with jsl Begin Data Update&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;jmp.run_jsl( 'dt &amp;lt;&amp;lt; Begin Data Update;' )
dt[ index ] = list_like_object       # numpy array, list, dataframe column,...
jmp.run_jsl( 'dt &amp;lt;&amp;lt; End Data Update;' )
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or by creating the data table invisible until you have filled the table, then make it visible. &amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import jmp
dt = jmp.DataTable('Powered By Python', 40, visibility='Invisible')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;...
# fill table
...

jmp.globals['jdt'] = dt     # set jdt in JSL to reference dt
jmp.run_jsl('::jdt &amp;lt;&amp;lt; Show Window(1);')&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The optional visibility parameter may be JMP 19 and above. &amp;nbsp;The jmp.globals[ ] is a 19 feature.&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 31 Oct 2025 03:30:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910687#M106981</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-10-31T03:30:28Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910688#M106982</link>
      <description>&lt;P&gt;The jmp.run_jsl( 'dt &amp;lt;&amp;lt; Begin Data Update;' ) &amp;nbsp;is assuming dt is the JSL variable for the table in JSL and then on the Python side as well. Such as caused by a Python Send(dt); from JSL, but not necessarily the same if the table was created from Python.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 03:34:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910688#M106982</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-10-31T03:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910706#M106987</link>
      <description>&lt;P&gt;Many thanks for the explanation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, the code:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;dt[ index ] = list_like_object &lt;/LI-CODE&gt;
&lt;P&gt;in &lt;U&gt;Python&lt;/U&gt; fills the column &lt;STRONG&gt;step by step&lt;/STRONG&gt;? Which is causing the speed issue?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;It looks similar to&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt[ 0, columnname] = [values ...]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;in &lt;U&gt;JSL&lt;/U&gt;,&amp;nbsp;which fills the column in one step - and doesn't need to be wrapped by&amp;nbsp;&lt;FONT face="courier new,courier"&gt;&lt;SPAN&gt;dt &amp;lt;&amp;lt; Begin/end Data Update&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Good to know. Where can I find further documentation about the details?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 05:31:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910706#M106987</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-05T05:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910736#M106989</link>
      <description>&lt;P&gt;I don't know how many users know how essential&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Begin Data Update;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is for writing good code. But I am sure that many users don't know.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Related&amp;nbsp; wish from&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7011"&gt;@bswedlove&lt;/a&gt;&amp;nbsp; for &lt;FONT face="courier new,courier"&gt;for each row():&lt;BR /&gt;&lt;BR /&gt;&lt;LI-MESSAGE title="for each row(data update=1, ...)" uid="591793" url="https://community.jmp.com/t5/JMP-Wish-List/for-each-row-data-update-1/m-p/591793#U591793" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-idea-thread lia-fa-icon lia-fa-idea lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Great idea to &lt;EM&gt;&lt;STRONG&gt;institutionalize a solution - to make the issue disappear for the user (the solution is always there).&lt;/STRONG&gt;&lt;BR /&gt;Holds for JSL and python.&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 05:32:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910736#M106989</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-05T05:32:15Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910820#M107005</link>
      <description>&lt;P&gt;"&lt;SPAN&gt;The JMP data table dt can be indexed by 0-based column index or by column name. &amp;nbsp;Index would be faster since it would avoid string comparisons.&lt;/SPAN&gt;"&lt;/P&gt;
&lt;P&gt;Trying to rewrite code using indices but can't seem to find the equivalent syntax for determining datatable column index from a name that I have for dataframes.&lt;/P&gt;
&lt;P&gt;dfColumnIndex = df.get_loc['NameofDataFrameColumn']&lt;/P&gt;
&lt;P&gt;dtColumnIndex = ???&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 15:59:18 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910820#M107005</guid>
      <dc:creator>MeanChris</dc:creator>
      <dc:date>2025-10-31T15:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910832#M107007</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/14366"&gt;@jthi&lt;/a&gt;&amp;nbsp;, what was the name for "adding some code to fix an issue that is not existing"?&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 16:35:17 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910832#M107007</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-10-31T16:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910836#M107009</link>
      <description>&lt;P&gt;In the case where df was created from a dt, the assumption would be that they have the same index. &amp;nbsp;If you've added columns to the data frame or one was not the origin of the other then using the dt['col_name'] = &amp;nbsp; &amp;nbsp;is probably your only recourse. &amp;nbsp;It shouldn't be that costly compared to an index but it is a string compare vs direct numeric indexing.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 17:30:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910836#M107009</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-10-31T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910837#M107010</link>
      <description>&lt;P&gt;This all happens within the magic of Python's Protocol Buffers, where the data is mapped in memory between the supported blocks of memory. &amp;nbsp;It might not need bracketing with Begin | End Data Update, but if it can't map the entire column at once, it will fallback to iterating across the values so bracketing with the Data Update statements is a good safety net.&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 17:34:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910837#M107010</guid>
      <dc:creator>Paul_Nelson</dc:creator>
      <dc:date>2025-10-31T17:34:32Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910854#M107012</link>
      <description>&lt;P&gt;I ran numerous experiments and different methods.&amp;nbsp; Some threw warnings.&amp;nbsp; Some did not.&amp;nbsp; The simplest seemed to be to create a dt from the df and then use the dt to transfer data.&amp;nbsp; That never threw an error.&lt;/P&gt;
&lt;P&gt;However, as to the speed problem... the ONLY thing that made a difference was whether I was trying to write values to a column that had been newly created, or if I was trying to write values to a column that existed when the datatable was opened (or created).&amp;nbsp; Newly created columns updated extremely slow.&amp;nbsp; Preexisting columns updated plenty fast.&lt;/P&gt;
&lt;P&gt;Results of last text on 100k rows.&amp;nbsp; 4 parameters already existed and 5 new columns added before I ran this code.&amp;nbsp; 9 total columns updated.&lt;/P&gt;
&lt;P&gt;#These 'xfers' all used dt['colname'] = dt_results['colname'] syntax. No DataFrames involved after DF was used to create dt_results.&lt;/P&gt;
&lt;P&gt;Step df_results creation time: 0.3434 seconds&lt;BR /&gt;Step Param 1 xfer time: 0.1795 seconds&lt;BR /&gt;Step Param 2 xfer time: 0.1758 seconds&lt;BR /&gt;Step df_results creation time: 0.0231 seconds #This is a new set of result of different df function return.&lt;BR /&gt;Step Param 3 xfer time: 0.1838 seconds&lt;BR /&gt;Step Param 4 xfer time: 0.1890 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#Code here was: dt['NewCol1Test'] = df_results[stringnameofcolumn]&lt;/P&gt;
&lt;P&gt;FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`&lt;BR /&gt;df to dt with names xfer time: 15.8251 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#Code here was: dt['NewCol2Test'] = df_results.iloc[:,dfColumnIndex]&lt;/P&gt;
&lt;P&gt;FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`&lt;BR /&gt;#I don't know why that warning was still thrown when I used iloc&lt;/P&gt;
&lt;P&gt;df to dt with iloc xfer time: 16.0874 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#Code here was: dt['NewCol3Test'] = dt_results[dfColumnIndex]&lt;/P&gt;
&lt;P&gt;dt index to dt name xfer time: 14.5659 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#Code here was: dt[NewColumnIndex] = dt_results[dfColumnIndex]&lt;/P&gt;
&lt;P&gt;dt index to dt index xfer time: 14.4699 seconds&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#Code here was:&lt;/P&gt;
&lt;P&gt;jmp.run_jsl('dt &amp;lt;&amp;lt; Begin Data Update;')&lt;BR /&gt;dt['NewCol5Test'] = dt_results[dfColumnIndex]&lt;BR /&gt;jmp.run_jsl('dt &amp;lt;&amp;lt; End Data Update;')&lt;/P&gt;
&lt;P&gt;#Warning/Error Result:&lt;/P&gt;
&lt;P&gt;"Name Unresolved: dt in access or evaluation of 'dt' , dt/*###*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at line 1&lt;BR /&gt;Name Unresolved: dt in access or evaluation of 'dt' , dt/*###*/&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;at line 1"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;#This print was actually on the same line as the second 'at line 1' error message.&lt;/P&gt;
&lt;P&gt;dt to dt w indices wrapped in begin/end update xfer time: 14.3627 seconds&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#Final summary of run time on 100k rows.&lt;/P&gt;
&lt;P&gt;Total Execution time: 77.0904 seconds&lt;/P&gt;</description>
      <pubDate>Fri, 31 Oct 2025 22:19:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910854#M107012</guid>
      <dc:creator>MeanChris</dc:creator>
      <dc:date>2025-10-31T22:19:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910892#M107014</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;save you data (*) before running this code a second time (**)&amp;nbsp; - or enable the begin/end data update!&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import jmp
import numpy as np
dt = jmp.open(jmp.SAMPLE_DATA + "Wafer Stacked.jmp")

jmp.globals['jdt'] = dt

jmp.run_jsl('Graph Builder( Variables( Y( :defects ) ), Elements( Bar( Y, Label( "Label by Value" ) ) ))');

# jmp.run_jsl('jdt &amp;lt;&amp;lt; Begin Data Update;')
dt[ 5 ] = [np.random.randint(1000)]*177875
# jmp.run_jsl('jdt &amp;lt;&amp;lt; End Data Update;')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(*) Just kidding, you will not lose your data - just take a coffee and wait till JMP finishes.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Dec 2025 21:36:26 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/910892#M107014</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-12-25T21:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911167#M107043</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/26800"&gt;@hogi&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;... a second time (**) &lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;BR /&gt;(**)&amp;nbsp;TS - 00251136&lt;BR /&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7749"&gt;@Dahlia_Watkins&lt;/a&gt;&amp;nbsp;noticed that sometimes it takes 2 execution of the code to face the speed issue.&lt;BR /&gt;&lt;BR /&gt;Looks like a timing "issue".&lt;BR /&gt;Maybe:&amp;nbsp; when you run the code the first time, the plot is not created till Python finishes the row-by-row-data update.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;edit:&lt;BR /&gt;Actually, the plot is not necessary as an interactive element to make the Python data update slow.&lt;BR /&gt;Further examples without interactive elements can be found in the posts below.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 06:07:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911167#M107043</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-05T06:07:51Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911234#M107051</link>
      <description>&lt;P&gt;I added the topic to&amp;nbsp;&lt;LI-MESSAGE title="Caution: Places where Jmp does something unexpected" uid="699820" url="https://community.jmp.com/t5/Discussions/Caution-Places-where-Jmp-does-something-unexpected/m-p/699820#U699820" discussion_style_icon_css="lia-mention-container-editor-message lia-img-icon-forum-thread lia-fa-icon lia-fa-forum lia-fa-thread lia-fa"&gt;&lt;/LI-MESSAGE&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 06:09:53 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911234#M107051</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-05T06:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911264#M107056</link>
      <description>&lt;P&gt;For the original issue: "slow data access IF there is a new column"&lt;/P&gt;
&lt;P&gt;here is is an illustrative&amp;nbsp; example:&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import jmp

dt = jmp.DataTable('dt_new', 50000)
col = dt.new_column("newCol")

# ---------   cut here to make it slow - why? ------------- 


dt[ 0 ] = [1]*50000&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cut into&amp;nbsp;2 steps, it will take JMP several seconds to get the 50,000 entries updated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;puzzling:&lt;/STRONG&gt;&lt;BR /&gt;When executing both blocks in one run, JMP has no issue.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Nov 2025 06:12:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911264#M107056</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-05T06:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911269#M107057</link>
      <description>&lt;P&gt;Besides the workarounds mentioned in&amp;nbsp;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/7172"&gt;@Paul_Nelson&lt;/a&gt;&amp;nbsp;'s post, I thought there were some additional ones like:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Use JSL to to create the column / the data table&lt;/LI&gt;
&lt;LI&gt;Use JSL to fill the column with dummy values&lt;/LI&gt;
&lt;LI&gt;use JSL to save the data table, close it and re-open it&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;STRIKE&gt;&lt;STRIKE&gt;&lt;STRIKE&gt;&lt;BR /&gt;&lt;/STRIKE&gt;&lt;/STRIKE&gt;&lt;/STRIKE&gt;Many of them looks good at first sight - but it's&amp;nbsp; misleading.&lt;BR /&gt;The high speed is just&amp;nbsp; because same values are written again into the column and JMP doesn't trigger a "data update alert":&lt;STRIKE&gt;&lt;STRIKE&gt;&lt;STRIKE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STRIKE&gt;&lt;/STRIKE&gt;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;P&gt;e.g.&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;jmp.globals['jdt'] = dt
jmp.run_jsl('''
nc = n cols(jdt);
Column(jdt,nc) &amp;lt;&amp;lt; set each value(1)
''');

nc = dt.ncols
data = [1]*50000
dt[ nc - 1 ] =data
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;STRIKE&gt;&lt;STRIKE&gt;&lt;BR /&gt;&lt;/STRIKE&gt;&lt;/STRIKE&gt;the same miracle via Python:&lt;STRIKE&gt;&lt;STRIKE&gt;&lt;BR /&gt;&lt;/STRIKE&gt;&lt;/STRIKE&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;# 1st: slow
nc = dt.ncols
dt[ nc - 1 ] = range(50000)

# fast !   (same values!)
dt[ nc - 1 ] = range(50000)

# new values: slow again
dt[ nc - 1 ] = [5]*50000&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Nov 2025 06:18:09 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911269#M107057</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-05T06:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: Python in JMP: dataframe column to datatable column best practices and computation speed implications</title>
      <link>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911294#M107070</link>
      <description>&lt;P&gt;One can set up a trigger to get a notification when JMP thinks that data gets updated.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import jmp
dt = jmp.open(jmp.SAMPLE_DATA + "Big Class.jmp")

jmp.run_jsl('''
New Column( "trigger",
	Formula(
		If( Row() == 1,
			Try( Caption( Char( ::i=::i+1 ) ), ::i = 1 )
		);
		:age;i
	)
)
''')


dt[ 1 ] = range(40)

dt[ 1 ] = range(40) # no data update !

dt[ 1 ] = [2]*40

# for loop without begin/end data update -&amp;gt; finished before JMP notices the data update
jmp.run_jsl('''
for each row(:age = row());
wait(5);
''')

# for loop without begin/end data update - and some delay to give JMP the time to notice:
jmp.run_jsl('''
for each row(:age = 2*row();wait(0))
''')&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;div class="lia-vid-container video-embed-center"&gt;&lt;div id="lia-vid-6384519696112w764h540r890" class="lia-video-brightcove-player-container"&gt;&lt;video-js data-video-id="6384519696112" data-account="6058004218001" data-player="default" data-embed="default" class="vjs-fluid" controls="" data-application-id="" style="width: 100%; height: 100%;"&gt;&lt;/video-js&gt;&lt;/div&gt;&lt;script src="https://players.brightcove.net/6058004218001/default_default/index.min.js"&gt;&lt;/script&gt;&lt;script&gt;(function() {  var wrapper = document.getElementById('lia-vid-6384519696112w764h540r890');  var videoEl = wrapper ? wrapper.querySelector('video-js') : null;  if (videoEl) {     if (window.videojs) {       window.videojs(videoEl).ready(function() {         this.on('loadedmetadata', function() {           this.el().querySelectorAll('.vjs-load-progress div[data-start]').forEach(function(bar) {             bar.setAttribute('role', 'presentation');             bar.setAttribute('aria-hidden', 'true');           });         });       });     }  }})();&lt;/script&gt;&lt;a class="video-embed-link" href="https://community.jmp.com/t5/video/gallerypage/video-id/6384519696112"&gt;(view in My Videos)&lt;/a&gt;&lt;/div&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So, indeed, there is no "data update" when the original and new values are identical.&lt;BR /&gt;Implemented to combat infinite loops? Great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Interesting,&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;import jmp
dt = jmp.open(jmp.SAMPLE_DATA + "Wafer Stacked.jmp")

jmp.run_jsl('''
delete symbols(::i)
New Column( "trigger",
	Formula(
		If( Row() == 1,
			Try( Caption( Char( ::i=::i+1 ) ), ::i = 1 )
		);
		:Y_Die;i
	)
)
''')

nr = dt.nrows
dt[ 4 ] = range(nr)&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;takes more than 1 minute -&amp;nbsp; And i counts up to 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Nov 2025 21:43:20 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Python-in-JMP-dataframe-column-to-datatable-column-best/m-p/911294#M107070</guid>
      <dc:creator>hogi</dc:creator>
      <dc:date>2025-11-04T21:43:20Z</dc:date>
    </item>
  </channel>
</rss>

