Apache Parquet ファイル インポーターこのアドインは、Apache Parquet ファイルを対話的にインポートします ( https://parquet.apache.org/ ) を JMP テーブルに追加します。
これは 2 つのコマンドで構成されます。
- 単一ファイル: 単一の .parquet ファイルを選択し、その有効性をチェックし、確認メッセージの後に結果として生成される JMP データ テーブルを作成して開きます。ファイルが有効でない場合は警告メッセージを発行します。
- 複数のファイル: すべての .parquet ファイルが含まれるフォルダーを選択し、結果の JMP テーブルを開きます (注: フォルダーには次のファイルが含まれている必要があります)のみ有効です.parquet ファイル、その他のファイルやサブフォルダーは含まれません)
システム要求:
標準の Python 更新ツールを使用して、Python 構成にこれらのパッケージをインストールします。
注: アドインをテストするには、サンプル Parquet ファイルをここで見つけることができます。 https://github.com/Teradata/kylo/tree/master/samples/sample-data/parquet
サードパーティの統合Re: Apache Parquet ファイル インポーター最大、
JMP Pro 17.2 でアドインをテストして、パンダを通じて生成された寄木細工ファイルのロードを確認しましたが、機能せず、ファイルを認識しませんでした (Tad などの寄木細工リーダー プログラムで読み取れる場合でも)。
助けをお待ちしています、ありがとう!
Re: Apache Parquet ファイル インポーターこんにちは、dmdiego さん
必要な Python パッケージはすべてインストールしましたか?
「はい」の場合、何が起こっているかをより詳しく確認できるよう、JMP ログを共有してください。
ちなみに、JMP V18 (2024 年 3 月に出荷予定) には、より直接的な JMP-Python リンクが含まれるため、アドインが更新される可能性があります。
乾杯、マッシモ
Re: Apache Parquet ファイル インポーター最大、
すべてのパッケージを入手したと思います。これが私のセットアップです:
Python バージョン 3.11.7
numpy バージョン 1.26.3
パンダバージョン 2.1.4
matplotlib バージョン 3.8.0
scipyバージョン1.11.4
sqlite3 (Python ベースに含まれています)
PyQt5 バージョン 5.15.10
pyarrow バージョン 14.0.2
私が考えることができる唯一のことは、conda を介してベース環境でパッケージを管理していることですが、これが競合しているかどうかはわかりません。または、私のコンピューターで Python がセットアップされた方法...
これは JMP からのログです。
/*:
/**********/
numpyをnpとしてインポート
パンダをPDとしてインポートする
pyarrowをPAとしてインポート
pyarrow.parquetをpqとしてインポートします
# Parquet 形式からテーブルを読み取る
テーブル = pq.read_table(parquet_file)
# テーブルをパンダ互換のデータフレームに変換する
df = table.to_pandas()
#print(df)
/**********/
単純なサンプル寄木細工ファイルを使用した場合でも、同じエラーが発生します。

Re: Apache Parquet ファイル インポーターこんにちは、dmdiego さん
設定は問題ないようで、conda は問題ないはずです。
ログには多くのことは書かれていません。
直接テストできるよう、使用している寄木細工のファイルを共有していただけますか?
ありがとう、マッシモ
Re: Apache Parquet ファイル インポーター元のリンクのサンプル ファイルを使用した場合: https://github.com/Teradata/kylo/tree/master/samples/sample-data/parquetも機能しませんでした。そのため、これらのファイルをロードできず、同じエラー メッセージが表示されます。
Re: Apache Parquet ファイル インポーターこんにちは、それはリンクすべきではありませんが、おそらくアドインのインストールに関連しているはずで、JMP Pro v17.2 と競合する可能性があります。
以下のスクリプトをコピーして、スクリプト ウィンドウで (アドインなしで) 実行してみて、動作するかどうか教えていただけますか。
ありがとう、マッシモ
//<BR />Names Default To Here( 1 );
// Pick Parquet file from directory
parquet_file_pf = Pick File( "Select Parquet File", , {"Parquet Files|parquet"} );
// Create Parquet_file string to pass to Python - exclude initial slash
parquet_file = Substr( parquet_file_pf, 2 );
// Extract Parquet file name without .parquet extension - to be used as JMP table name
parquet_filename = Word( -2, parquet_file, "/." );
// Show( parquet_file );
// Init Python connection
Python Init();
// Send Parquet complete file string to Python
Python Send( parquet_file );
//Python Submit( "print(parquet_file)" );
// Read Parquet file as a table, then read table as pandas DataFrame
Python Submit(
"\[
import numpy as np
import pandas as pd
import pyarrow as pa
import pyarrow.parquet as pq
# Read a Table from Parquet format
table = pq.read_table(parquet_file)
# Convert Table to a pandas-compatible DataFrame
df = table.to_pandas()
#print(df)
]\"
);
// Get DataFrame as a JMP Data Table
dt = Python Get( df );
// check dt successfully imported
Try(
Is Missing( dt );
table_imported = 0;
,
table_imported = 1
);
// if dt is not a valid data table, set error message and close program
If( (table_imported == 0),
nw = New Window( "Import not successful", Modal, Text Box( "File " || parquet_filename || ".parquet is not a valid Parquet file" ) );
Stop();
);
// If dt is valid, continue execution
// Rename JMP Data Table as Parquet file name without extension
dt << Set Name( parquet_filename );
// Modal message window to confirm import
import_message = "File " || parquet_filename || ".parquet successfully imported";
nw = New Window( "Import successful", Modal, Text Box( import_message ) );
// Open JMP Data Table
dt << New Data View;
// Save JMP Data Table
// dt << Save();
// Terminate Python session
Python Term();
Re: Apache Parquet ファイルインポーター私の JMP Discovery Summit プレゼンテーションからそのまま引用すると、parquet ファイルを処理する JMP 18 スクリプトで、Parquet 列から jmp.DataTable Python オブジェクトに直接移動します。JMP 18 では、Python から JMP データ テーブルをライブで作成、読み取り、変更できます。次のスクリプトは、Teradtata サンプル ファイルの 1 つを使用し、parquet ファイルのスキーマにアクセスして、比較可能なデータ テーブル列を Python で直接作成します。次のスクリプトは、JMP 18 の Python 対応スクリプト エディターから直接実行されます。import jmpパッケージは、JMP 実行可能ファイルのコード ベース内で C++ 拡張機能として記述されているため、JMP 内からのみ使用できます。
# parquet.py
# Author: Paul R. Nelson
# JMP Statistical Discovery LLC
#
# Description:
# Directly read a pyarrow table and create a JMP datatable. Discovered
# some issues in EA-5, that prevented this from working as desired,
# There is a conditional based on jmp.__version__ to check for EA-6
# or newer.
#
# The data for this file comes from a repository that is Apache licensed.
# https://github.com/Teradata/kylo/blob/master/samples/sample-data/parquet/userdata1.parquet
#
jmpをインポートする
import pyarrow.parquet as pq
from pyarrow import types as ptypes
# verify JMP 18 EA-6 or newer
ver = jmp.__version__.split('.')
if(ver[0] == '0' and ver[1] < '6'):
print('This version requires JMP 18.0 EA-6 or newer.')
pq_Table = pq.read_table('/Users/me_me_me/Presentation/Parquet/userdata1.parquet')
# Create a helper function to build a JMP Column
# on DataTable 'dt' using parquet 'table', having column 'name'
def dtcol_from_pq_col_name(dt, table, name):
col = None
idx = table.schema.get_field_index(name)
col_type = table.schema[idx].type
print(f'{name}: {table.schema[idx].type}')
if ptypes.is_string(col_type):
col = dt.new_column(name, jmp.DataType.Character)
elif ptypes.is_date(col_type):
# This table does not contain a date column do this is unimplemented
print("FixMe: got a date column")
return None
elif ptypes.is_timestamp(col_type):
col = dt.新しい列(name, jmp.DataType.数値)
# add JMP epoch time correction factor - 1Jan1904
timestamps = [ts.timestamp()+ 2082844800.0 for ts in table.column(idx).to_pylist()]
dt[name] = timestamps
# change column info to timestamp, and set an appropriate column width.
jmp.run_jsl(f'Data Table( "{dt.name}" ):{name} << Input Format( "yyyy-mm-dd" ) << Format( "yyyy-mm-ddThh:mm:ss", 19 ) << Set Display Width( 200 );')
else:
col = dt.new_column(name, jmp.データ型.数値) # Numeric
dt[名前] = table.column(idx).to_pylist()
return col
# Create JMP data table with four of the columns from the table by name
dt = jmp.データテーブル('From Parquet', pq_Table.num_rows)
# could just as easily create all columns
# pq_Table.column_names の n の場合:
# instead of iterating on the list below
col_list = [ 'registration_dttm', 'first_name', 'last_name', 'salary']
for n in col_list:
dtcol_from_pq_col_name(dt, pq_Table, n)
# set column properties by calling JSL from Python. (フォーマットと幅)
jmp.run_jsl('''
// Change column display width: last_name
Data Table( "From Parquet" ):last_name << Set Display Width( 105 );
// Change column display width: Salary
Data Table( "From Parquet" ):salary << Set Display Width( 150 ) << Format( "Currency", "USD", 17, 2 );
''')
# display data about the parquet file
print(f'Table Rows: {len(pq_Table)}' )
print(f'Table Shape: {pq_Table.shape}')
print(f'Table Schema:\n{pq_Table.schema}')
print(pq_Table.schema.field('salary').type)
print(f'Column Names: {pq_Table.column_names}')
print(f'Num Columns: {pq_Table.num_columns}')
Re: Apache Parquet ファイルインポーター最大、
スクリプトは非常にうまく機能し、parquet ファイルを正常に読み込むことができます。これは本当に非常に便利です。アドインの代わりにスクリプトを実行するだけです。親切なご助力に感謝します。
しかし、実際にはアドインに問題があり、現在の JMP Pro のインストールでは動作しません。ただし、スクリプトは動作します。