Datasets:

wangdx25 commited on
Commit
71b21f6
·
verified ·
1 Parent(s): b2b7e8b

Add a runnable TsFile Usage example

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