-
Notifications
You must be signed in to change notification settings - Fork 2
/
view_parquet.py
33 lines (22 loc) · 942 Bytes
/
view_parquet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import pandas as pd
import os
parquet_files_folder = '../persons-photo-concept-bucket-images-to-train/open_pose_controlnet/data'
file_list = os.listdir(parquet_files_folder)
file_list.sort()
for file_name in file_list[1:]:
if file_name.endswith('.parquet'):
print(f"File: {file_name}")
file_path = os.path.join(parquet_files_folder, file_name)
df = pd.read_parquet(file_path)
# for column in ['image', 'conditioning_image']:
# df[column] = df[column].apply(lambda x: {"bytes": x, 'path': None})
# df.to_parquet(file_path, engine='pyarrow')
# print(f"File: {file_name}")
print(f"Number of rows: {len(df)}")
# print(f"Columns: {df.columns}")
# print(df.head(5))
print("First row:")
print(df.iloc[0])
# print(df.iloc[0]['conditioning_image'])
# # print(df.iloc[-1]['image'])
# print("\n\n")