Datasets:

wangdx25 commited on
Commit
d22a076
·
verified ·
1 Parent(s): 15987b5

Add a runnable TsFile Usage example

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