Skip to content

Instantly share code, notes, and snippets.

@chathurawidanage
Last active May 13, 2022 14:38
Show Gist options
  • Save chathurawidanage/87ba771b883230325c582071b06fb39a to your computer and use it in GitHub Desktop.
Save chathurawidanage/87ba771b883230325c582071b06fb39a to your computer and use it in GitHub Desktop.
generate data
import types
import pyarrow.parquet as pq
import pyarrow as pa
import pandas as pd
import numpy as np
data = np.array(np.random.random_sample((5,)), dtype=np.float32)
data2 = np.array(np.random.random_sample((5,)), dtype=np.float32)
data3 = np.array(np.random.random_sample((5,)), dtype=np.float32)
df = pd.DataFrame({
'x': data,
'y': data2,
'z': data3
})
df2 = pd.DataFrame({
'a': data,
'b': data2,
'c': data3
})
table = pa.Table.from_pandas(df)
pq.write_table(table, 'nation.parquet')
table = pa.Table.from_pandas(df2)
pq.write_table(table, 'region.parquet')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment