<?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: How can I quickly reassemble and generate different tables from many JMP tables? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809428#M98965</link>
    <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;By contrast&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Processing CSV is much faster.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-11-01_18-09-48.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69741i9797DAF868BF1AAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-11-01_18-09-48.png" alt="2024-11-01_18-09-48.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 01 Nov 2024 10:12:43 GMT</pubDate>
    <dc:creator>lala</dc:creator>
    <dc:date>2024-11-01T10:12:43Z</dc:date>
    <item>
      <title>How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809424#M98961</link>
      <description>&lt;P&gt;There are now 2400 such JMP files in the same directory C:\8: JMP tables with file names with detailed time stamps and 5000 rows of data each.For example, C:\8\20241031112503.JMP.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;S5 E5 S4 E4 S3 E3 S2 E2 S1 E1 B1 T1 B2 T2 B3 T3 B4 T4 B5 T5 enco
6024 2 6023 10 6021 6 6020 96 6019 18 6018 400 6017 16 6016 78 6015 41 6014 8 603198
1263 88 1262 290 1261 254 1260 347 1259 301 1258 544 1257 364 1256 630 1255 1123 1254 362 600377&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Now need to reorganize the table to save the file according to the code number of the "enco" column, of course, the same "enco" so that the timestamp data in the original file name should be added to distinguish.&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Instructions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;"enco" is not repeated on each line of the same file.&lt;/SPAN&gt;&lt;SPAN class=""&gt;And enco isn't exactly the same in 2400 files&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The key is to find a way to do this quickly.Either JSL or python methods can be used with JMP software (indicating python in the JMP environment).&lt;BR /&gt;Of course, if the original file is in CSV format or some database format that is more convenient for this kind of splitting and sorting, you can provide better suggestions.Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:03:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809424#M98961</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-11-01T08:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809425#M98962</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;I tried to combine them all into a JMP table and then extract subsets.&lt;/SPAN&gt;&lt;SPAN class=""&gt;The speed is slow.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Whether to create different memory arrays in memory to concatenate is faster, but this will make the code more complex.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;Thanks Experts!&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:00:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809425#M98962</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-11-01T08:00:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809426#M98963</link>
      <description>&lt;P&gt;I would first try with Multiple File Import if it can handle that (build single table with source (filename) and go from there). Then I would maybe try some JSL solution, then possible some other JSL solution and lastly Python Integration with DuckDB.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:01:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809426#M98963</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-01T08:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809427#M98964</link>
      <description>&lt;P&gt;Thanks Experts!&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Yes, I also want to try new methods.&lt;/SPAN&gt;&lt;SPAN class=""&gt;Ask experts how to implement Python and DuckDB specifically?&lt;/SPAN&gt;&lt;SPAN class=""&gt;Thank you very much!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:08:01 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809427#M98964</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-11-01T08:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809428#M98965</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;By contrast&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Processing CSV is much faster.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-11-01_18-09-48.png" style="width: 999px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69741i9797DAF868BF1AAA/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-11-01_18-09-48.png" alt="2024-11-01_18-09-48.png" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 10:12:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809428#M98965</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-11-01T10:12:43Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809429#M98966</link>
      <description>&lt;P&gt;I can provide suggestions for JMP (and JSL) but for that I do need more examples and proper understanding of what you are trying to achieve. Are you trying to have one unique file for each enco? Do all tables contain exactly the same columns? Do they always contain similar data (integers)? Do they always have just two rows? Are the file names always in the same format? Do the tables have headers properly set or is the first row character data with the headers?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I consider that (pure) Python questions belong (mostly) to other forums. If you have the data as .csv files using DuckDB should be simple task. Also when using Python it is definitely worth it to learn to read the documentation of each of the libraries you are using instead of just relying on LLM (&lt;A href="https://duckdb.org/docs/data/multiple_files/overview.html" target="_blank"&gt;Reading Multiple Files – DuckDB&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Fri, 01 Nov 2024 08:49:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809429#M98966</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-11-01T08:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809430#M98967</link>
      <description>&lt;P class=""&gt;&lt;SPAN class=""&gt;Yes, I also know that GPT-4o is not familiar with JSL of JMP software.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;So later I let it handle CSV directly.&lt;/SPAN&gt;&lt;/P&gt;&lt;P class=""&gt;&lt;SPAN class=""&gt;Then add the JSL syntax to make it modify again.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;import os&lt;BR /&gt;import duckdb&lt;BR /&gt;import pandas as pd&lt;BR /&gt;from pathlib import Path&lt;BR /&gt;output_dir = Path(r"C:\3")&lt;BR /&gt;output_dir.mkdir(exist_ok=True)&lt;BR /&gt;con = duckdb.connect(":memory:")&lt;BR /&gt;def process_csv_files():&lt;BR /&gt;csv_files = list(Path(r"C:\8").glob("*.CSV"))&lt;BR /&gt;first_file = csv_files[0]&lt;BR /&gt;timestamp = first_file.stem &lt;BR /&gt;con.execute("""&lt;BR /&gt;CREATE TABLE all_data AS &lt;BR /&gt;SELECT *, ? as file_timestamp &lt;BR /&gt;FROM read_csv_auto(?)&lt;BR /&gt;""", [timestamp, str(first_file)])&lt;BR /&gt;for csv_file in csv_files[1:]:&lt;BR /&gt;timestamp = csv_file.stem &lt;BR /&gt;con.execute("""&lt;BR /&gt;INSERT INTO all_data &lt;BR /&gt;SELECT *, ? as file_timestamp &lt;BR /&gt;FROM read_csv_auto(?)&lt;BR /&gt;""", [timestamp, str(csv_file)])&lt;BR /&gt;enco_values = con.execute("SELECT DISTINCT enco FROM all_data").fetchall()&lt;BR /&gt;for (enco,) in enco_values:&lt;BR /&gt;query = """&lt;BR /&gt;SELECT * &lt;BR /&gt;FROM all_data &lt;BR /&gt;WHERE enco = ?&lt;BR /&gt;ORDER BY file_timestamp&lt;BR /&gt;"""&lt;BR /&gt;df = con.execute(query, [enco]).df()&lt;BR /&gt;output_file = output_dir / f"{enco}.csv"&lt;BR /&gt;df.to_csv(output_file, index=False)&lt;BR /&gt;if __name__ == "__main__":&lt;BR /&gt;try:&lt;BR /&gt;process_csv_files()&lt;BR /&gt;except Exception as e:&lt;BR /&gt;print(f"E: {str(e)}")&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 01 Nov 2024 09:12:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809430#M98967</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-11-01T09:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: How can I quickly reassemble and generate different tables from many JMP tables?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809529#M99021</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Compared, or directly use CSV libraries and dictionaries, containers are the fastest.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 07:43:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-I-quickly-reassemble-and-generate-different-tables-from/m-p/809529#M99021</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-11-04T07:43:13Z</dc:date>
    </item>
  </channel>
</rss>

