Apache Parquet 파일 임포터이 추가 기능은 대화식으로 Apache Parquet 파일을 가져옵니다( https://parquet.apache.org/ ) JMP 테이블로.
다음 두 가지 명령으로 구성됩니다.
- 단일 파일 : 단일 .parquet 파일을 선택하고 유효성을 확인한 다음 확인 메시지 후 결과 JMP 데이터 테이블을 생성 및 열거나 파일이 유효하지 않은 경우 경고 메시지를 발행합니다.
- 여러 파일 : 모든 .parquet 파일이 있는 폴더를 선택하고 결과 JMP 테이블을 엽니다(참고: 폴더에는 유효한 .parquet 파일, 다른 파일이나 하위 폴더 없음)
시스템 요구 사항:
표준 Python 업데이트 도구를 사용하여 Python 구성에 대해 이러한 패키지를 설치하십시오.
참고: 추가 기능을 테스트하기 위해 여기에서 샘플 Parquet 파일을 찾을 수 있습니다. https://github.com/Teradata/kylo/tree/master/samples/sample-data/parquet
타사 통합Re: Apache Parquet 파일 가져오기 도구최고,
Pandas를 통해 생성된 Parquet 파일 로드를 확인하기 위해 JMP Pro 17.2에서 추가 기능을 테스트했는데 작동하지 않고 파일을 인식하지 못합니다(Tad와 같은 Parquet 리더 프로그램으로 읽을 수 있음에도 불구하고).
어떤 도움이라도 기다리겠습니다. 감사합니다!
Re: Apache Parquet 파일 가져오기 도구안녕하세요 dmdiego님,
필요한 Python 패키지를 모두 설치하셨나요?
그렇다면 무슨 일이 일어나고 있는지 더 잘 확인할 수 있도록 JMP 로그를 공유해 주세요.
그런데 JMP V18(2024년 3월 출시 예정)은 더욱 직접적인 JMP-Python 링크를 갖게 되므로 추가 기능을 업데이트할 가능성이 높습니다.
건배, 마시모
Re: Apache Parquet 파일 가져오기 도구최고,
모든 패키지를 얻은 것 같습니다. 이것이 제 설정입니다.
파이썬 버전 3.11.7
numpy 버전 1.26.3
팬더 버전 2.1.4
matplotlib 버전 3.8.0
사이피 버전 1.11.4
sqlite3(Python 기본에 포함됨)
PyQt5 버전 5.15.10
pyarrow 버전 14.0.2
내가 생각할 수 있는 유일한 것은 충돌인지 확실하지 않은 conda를 통해 기본 환경에서 패키지를 관리한다는 것입니다. 아니면 내 컴퓨터에 Python이 설정된 방식...
다음은 JMP의 로그입니다.
/*:
/************/
numpy를 np로 가져오기
팬더를 PD로 가져오기
pa로 pyarrow 가져오기
pyarrow.parquet를 pq로 가져오기
# Parquet 형식에서 테이블 읽기
테이블 = pq.read_table(parquet_file)
# 테이블을 팬더와 호환되는 DataFrame으로 변환
df = table.to_pandas()
#인쇄(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.DataTable Python 객체로 직접 이동하는 Parquet 파일 처리용 JMP 18 스크립트를 소개합니다. JMP 18을 사용하면 Python에서 JMP 데이터 테이블을 실시간으로 생성, 읽기, 수정할 수 있습니다. 다음 스크립트는 Teradtata 샘플 파일 중 하나를 사용하고, Parquet 파일의 스키마에 액세스하고, Python에서 직접 비교 가능한 데이터 테이블 열을 생성합니다. 다음은 JMP 18의 Python 인식 스크립트 편집기에서 직접 실행됩니다. 수입 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.new_column(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.DataType.숫자) # 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.DataTable('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 파일 가져오기 도구최고,
스크립트는 매우 잘 작동하며 쪽모이 세공 파일을 성공적으로 로드할 수 있습니다. 실제로 이것은 추가 기능 대신에 스크립트를 실행할 수 있어 매우 유용합니다. 친절한 도움에 감사드립니다!
하지만 실제로 현재 JMP Pro 설치에서 작동하지 않는 추가 기능에 문제가 있습니다. 그러나 스크립트는 작동합니다.