Add a runnable TsFile Usage example
Browse files
README.md
CHANGED
|
@@ -41,10 +41,34 @@ A [LeRobot](https://github.com/huggingface/lerobot) robot-manipulation dataset.
|
|
| 41 |
|
| 42 |
Camera video streams are **not** included in this repository; see the original dataset for the videos: https://huggingface.co/datasets/axiboai/umi_stacking_slow (`videos/` directory).
|
| 43 |
|
| 44 |
-
## Usage
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
## Source & license
|
| 49 |
|
| 50 |
- Original dataset: https://huggingface.co/datasets/axiboai/umi_stacking_slow
|
|
|
|
| 41 |
|
| 42 |
Camera video streams are **not** included in this repository; see the original dataset for the videos: https://huggingface.co/datasets/axiboai/umi_stacking_slow (`videos/` directory).
|
| 43 |
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
Install the Apache TsFile Python SDK (`pip install tsfile`) and read a converted file:
|
| 47 |
+
|
| 48 |
+
```python
|
| 49 |
+
from pathlib import Path
|
| 50 |
+
from tsfile import TsFileReader
|
| 51 |
+
|
| 52 |
+
path = Path("data/umi_stacking_slow.tsfile")
|
| 53 |
+
with TsFileReader(str(path)) as reader:
|
| 54 |
+
schemas = reader.get_all_table_schemas()
|
| 55 |
+
print("tables:", list(schemas))
|
| 56 |
+
table_name = next(iter(schemas))
|
| 57 |
+
table = schemas[table_name]
|
| 58 |
+
columns = [column.get_column_name() for column in table.get_columns()]
|
| 59 |
+
print("columns:", columns)
|
| 60 |
+
field_names = [
|
| 61 |
+
column.get_column_name()
|
| 62 |
+
for column in table.get_columns()
|
| 63 |
+
if column.get_column_name() not in {"Time", "time"}
|
| 64 |
+
]
|
| 65 |
+
if field_names:
|
| 66 |
+
with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
|
| 67 |
+
batch = result.read_arrow_batch()
|
| 68 |
+
if batch is not None:
|
| 69 |
+
print(batch.to_pandas().head())
|
| 70 |
+
```
|
| 71 |
+
|
| 72 |
## Source & license
|
| 73 |
|
| 74 |
- Original dataset: https://huggingface.co/datasets/axiboai/umi_stacking_slow
|