Datasets:
|
Download README.md from THULab/spx: direct link, hf CLI and curl.
- Browser
- Download file 3.34 kB
-
https://huggingface.co/datasets/THULab/spx/resolve/main/README.md
- Command line
-
hf download hf://datasets/THULab/spx/README.md
-
curl -L -o README.md https://huggingface.co/datasets/THULab/spx/resolve/main/README.md
3.34 kB
| license: mit | |
| language: | |
| - en | |
| task_categories: | |
| - time-series-forecasting | |
| - tabular-regression | |
| size_categories: | |
| - 10K<n<100K | |
| tags: | |
| - tsfile | |
| - timeseries | |
| - modality:timeseries | |
| - format:tsfile | |
| - finance | |
| - stock-market | |
| modality: timeseries | |
| pretty_name: S&P 500 Index History (TsFile format) | |
| configs: | |
| - config_name: default | |
| data_files: | |
| - split: train | |
| path: "spx.tsfile" | |
| # S&P 500 Index History (TsFile format) | |
| This dataset contains the historical S&P 500 index observations published in | |
| the source repository. Each dated row provides open, high, low, close, | |
| adjusted-close, and volume values for time-series forecasting and tabular | |
| analysis. | |
| Modalities: Time-series | |
| ## Source and scale | |
| - Original dataset: [misikoff/SPX](https://huggingface.co/datasets/misikoff/SPX) | |
| - Source revision: `498783fd0df5ad1f13c98e42329c60b8f8f9c6c1` | |
| - Source file: `^SPX.csv` (CSV) | |
| - Converted scale: 24,167 observations in one TsFile table. | |
| - Observed date range: 1928-01-03 through 2024-03-15. | |
| - Source split: one table; no validation or test split is defined. | |
| ## TsFile schema | |
| | Column | Role | TsFile type | Source meaning | | |
| |---|---|---|---| | |
| | Time | TIME | INT64 (ms) | Source `Date`, parsed at UTC midnight | | |
| | open | FIELD | DOUBLE | Opening index value | | |
| | high | FIELD | DOUBLE | Highest index value | | |
| | low | FIELD | DOUBLE | Lowest index value | | |
| | close | FIELD | DOUBLE | Closing index value | | |
| | adj_close | FIELD | DOUBLE | Adjusted closing index value | | |
| | volume | FIELD | INT64 | Source volume value | | |
| There are no TAG columns because the source contains one index series. | |
| ## Conversion notes | |
| - `Date` is represented losslessly as integer-millisecond `Time`; the | |
| redundant source date text is not duplicated as a FIELD. | |
| - Source measurement names are normalized to lowercase TsFile identifiers; | |
| `Adj Close` becomes `adj_close`. | |
| - All 24,167 rows and all six measurements are retained. The conversion does | |
| not infer a market-data provider or provenance beyond the source card. | |
| ## Files and usage | |
| - `spx.tsfile` | |
| ```python | |
| from tsfile import TsFileReader | |
| with TsFileReader("spx.tsfile") as reader: | |
| table = next(iter(reader.get_all_table_schemas())) | |
| with reader.query_table(table, ["close", "volume"], batch_size=1024) as result: | |
| batch = result.read_arrow_batch() | |
| if batch is not None: | |
| print(batch.to_pandas().head()) | |
| ``` | |
| ## License | |
| The source dataset is licensed under the MIT License. | |
| ## Usage | |
| Install the Apache TsFile Python SDK (`pip install tsfile`) and read a converted file: | |
| ```python | |
| from pathlib import Path | |
| from tsfile import TsFileReader | |
| path = Path("spx.tsfile") | |
| with TsFileReader(str(path)) as reader: | |
| schemas = reader.get_all_table_schemas() | |
| print("tables:", list(schemas)) | |
| table_name = next(iter(schemas)) | |
| table = schemas[table_name] | |
| columns = [column.get_column_name() for column in table.get_columns()] | |
| print("columns:", columns) | |
| field_names = [ | |
| column.get_column_name() | |
| for column in table.get_columns() | |
| if column.get_column_name() not in {"Time", "time"} | |
| ] | |
| if field_names: | |
| with reader.query_table(table_name, field_names[:3], batch_size=1024) as result: | |
| batch = result.read_arrow_batch() | |
| if batch is not None: | |
| print(batch.to_pandas().head()) | |
| ``` | |