File size: 1,484 Bytes
661a2a1 6c806b5 4248e51 0d7fdda 6c806b5 0d7fdda 6c806b5 0d7fdda 6c806b5 0d7fdda 6c806b5 0d7fdda 8676df5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
---
license: mit
task_categories:
- time-series-forecasting
language:
- en
size_categories:
- 1M<n<1B
tags:
- finance
---
# Timeseries Data Processing
This repository contains a script for loading and processing timeseries data using the `datasets` library and converting it to a pandas DataFrame for further analysis.
## Dataset
The dataset used in this example is `Weijie1996/load_timeseries`, which contains timeseries data with the following features:
- `id`
- `datetime`
- `target`
- `category`
## Requirements
- Python 3.6+
- `datasets` library
- `pandas` library
You can install the required libraries using pip:
```sh
pip install datasets pandas
```
## Usage
The following example demonstrates how to load the dataset and convert it to a pandas DataFrame.
```python
from datasets import load_dataset
ds = load_dataset("Weijie1996/load_timeseries", split='train')
# Print the category of the dataset
print(set(ds['category']))
print(set(ds['id']))
# Filter the dataset that category is 15m and id is GE_1
ds = ds.filter(lambda x: x['category'] == '30m' and x['id'] == 'GE_1')
# Transform the dataset to a pandas dataframe
df = ds.to_pandas()
```
## Output
``` data
id datetime target category
0 NL_1 2013-01-01 00:00:00 0.117475 60m
1 NL_1 2013-01-01 01:00:00 0.104347 60m
2 NL_1 2013-01-01 02:00:00 0.103173 60m
3 NL_1 2013-01-01 03:00:00 0.101686 60m
4 NL_1 2013-01-01 04:00:00 0.099632 60m
``` |