wangdx25 commited on
Commit
a3c317d
·
verified ·
1 Parent(s): e1763bf

Add TsFile (converted from misikoff/SPX)

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +112 -0
  3. spx.tsfile +3 -0
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ spx.tsfile filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ task_categories:
6
+ - time-series-forecasting
7
+ - tabular-regression
8
+ size_categories:
9
+ - 10K<n<100K
10
+ tags:
11
+ - tsfile
12
+ - timeseries
13
+ - modality:timeseries
14
+ - format:tsfile
15
+ - finance
16
+ - stock-market
17
+ modality: timeseries
18
+ pretty_name: S&P 500 Index History (TsFile format)
19
+ configs:
20
+ - config_name: default
21
+ data_files:
22
+ - split: train
23
+ path: "spx.tsfile"
24
+ ---
25
+
26
+ # S&P 500 Index History (TsFile format)
27
+
28
+ This dataset contains the historical S&P 500 index observations published in
29
+ the source repository. Each dated row provides open, high, low, close,
30
+ adjusted-close, and volume values for time-series forecasting and tabular
31
+ analysis.
32
+
33
+ Modalities: Time-series
34
+
35
+ ## Source and scale
36
+
37
+ - Original dataset: [misikoff/SPX](https://huggingface.co/datasets/misikoff/SPX)
38
+ - Source revision: `498783fd0df5ad1f13c98e42329c60b8f8f9c6c1`
39
+ - Source file: `^SPX.csv` (CSV)
40
+ - Converted scale: 24,167 observations in one TsFile table.
41
+ - Observed date range: 1928-01-03 through 2024-03-15.
42
+ - Source split: one table; no validation or test split is defined.
43
+
44
+ ## TsFile schema
45
+
46
+ | Column | Role | TsFile type | Source meaning |
47
+ |---|---|---|---|
48
+ | Time | TIME | INT64 (ms) | Source `Date`, parsed at UTC midnight |
49
+ | open | FIELD | DOUBLE | Opening index value |
50
+ | high | FIELD | DOUBLE | Highest index value |
51
+ | low | FIELD | DOUBLE | Lowest index value |
52
+ | close | FIELD | DOUBLE | Closing index value |
53
+ | adj_close | FIELD | DOUBLE | Adjusted closing index value |
54
+ | volume | FIELD | INT64 | Source volume value |
55
+
56
+ There are no TAG columns because the source contains one index series.
57
+
58
+ ## Conversion notes
59
+
60
+ - `Date` is represented losslessly as integer-millisecond `Time`; the
61
+ redundant source date text is not duplicated as a FIELD.
62
+ - Source measurement names are normalized to lowercase TsFile identifiers;
63
+ `Adj Close` becomes `adj_close`.
64
+ - All 24,167 rows and all six measurements are retained. The conversion does
65
+ not infer a market-data provider or provenance beyond the source card.
66
+
67
+ ## Files and usage
68
+
69
+ - `spx.tsfile`
70
+
71
+ ```python
72
+ from tsfile import TsFileReader
73
+
74
+ with TsFileReader("spx.tsfile") as reader:
75
+ table = next(iter(reader.get_all_table_schemas()))
76
+ with reader.query_table(table, ["close", "volume"], batch_size=1024) as result:
77
+ batch = result.read_arrow_batch()
78
+ if batch is not None:
79
+ print(batch.to_pandas().head())
80
+ ```
81
+
82
+ ## License
83
+
84
+ The source dataset is licensed under the MIT License.
85
+
86
+ ## Usage
87
+
88
+ Install the Apache TsFile Python SDK (`pip install tsfile`) and read a converted file:
89
+
90
+ ```python
91
+ from pathlib import Path
92
+ from tsfile import TsFileReader
93
+
94
+ path = Path("spx.tsfile")
95
+ with TsFileReader(str(path)) as reader:
96
+ schemas = reader.get_all_table_schemas()
97
+ print("tables:", list(schemas))
98
+ table_name = next(iter(schemas))
99
+ table = schemas[table_name]
100
+ columns = [column.get_column_name() for column in table.get_columns()]
101
+ print("columns:", columns)
102
+ field_names = [
103
+ column.get_column_name()
104
+ for column in table.get_columns()
105
+ if column.get_column_name() not in {"Time", "time"}
106
+ ]
107
+ if field_names:
108
+ with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
109
+ batch = result.read_arrow_batch()
110
+ if batch is not None:
111
+ print(batch.to_pandas().head())
112
+ ```
spx.tsfile ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2c522b266facc79efa7c79c6658395f64e23b17b09325db537d045be2f77b020
3
+ size 736001