CSV Yerine Parquet Kullanımı
Verileri csv ile kullanmak yerine sıkıştırılmış parquet formatında kullanabiliriz.
import numpy as np
import pandas as pd
# Create a dataset with 1 million rows and 10 columns
np.random.seed(256)
data = np.random.randint(0, 2**63, size=(1000000, 10))
df = pd.DataFrame(data, columns=[f'col{str(i)}' for i in range(10)])
# Write data to Parquet file
df.to_parquet('example.parquet')
# Write data to CSV file
df.to_csv('example.csv', index=False)
import os
print("Parquet file size:", os.path.getsize('example.parquet'))
print("CSV file size:", os.path.getsize('example.csv'))
Parquet file size: 82805080
CSV file size: 198796161
Comments
Post a Comment