(table_or_df)
| 130 | |
| 131 | |
| 132 | def make_sample_file(table_or_df): |
| 133 | import pyarrow.parquet as pq |
| 134 | |
| 135 | if isinstance(table_or_df, pa.Table): |
| 136 | a_table = table_or_df |
| 137 | else: |
| 138 | a_table = pa.Table.from_pandas(table_or_df) |
| 139 | |
| 140 | buf = io.BytesIO() |
| 141 | _write_table(a_table, buf, compression='SNAPPY', version='2.6') |
| 142 | |
| 143 | buf.seek(0) |
| 144 | return pq.ParquetFile(buf) |
| 145 | |
| 146 | |
| 147 | def alltypes_sample(size=10000, seed=0, categorical=False): |