Last active
May 13, 2022 14:38
-
-
Save chathurawidanage/87ba771b883230325c582071b06fb39a to your computer and use it in GitHub Desktop.
generate data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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