1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-11 06:46:56 +08:00

fix fillna bug (#1914)

* fix fillna bug

* fix flake8 error

* fix pylint error

* update ubuntu version for action

* fix pytest error

* fix pylint error

* fix black error

* fix pylint error

* add Fillna test

* fix black error

* add  instruments

* remove code
This commit is contained in:
Linlang
2025-04-25 11:18:09 +08:00
committed by GitHub
parent e7a1b5ea1f
commit 320bd65e19
7 changed files with 42 additions and 28 deletions

View File

@@ -10,6 +10,7 @@ sys.path.append(str(Path(__file__).resolve().parent))
from qlib.data.dataset.loader import NestedDataLoader, QlibDataLoader
from qlib.data.dataset.handler import DataHandlerLP
from qlib.contrib.data.loader import Alpha158DL, Alpha360DL
from qlib.data.dataset.processor import Fillna
from qlib.data import D
@@ -30,7 +31,7 @@ class TestDataLoader(unittest.TestCase):
)
# Of course you can use StaticDataLoader
dataset = nd.load(start_time="2020-01-01", end_time="2020-01-31")
dataset = nd.load(instruments="csi300", start_time="2020-01-01", end_time="2020-01-31")
assert dataset is not None
@@ -45,6 +46,13 @@ class TestDataLoader(unittest.TestCase):
assert "LABEL0" in columns_list
assert dataset.isna().any().any()
fn = Fillna(fields_group="feature", fill_value=0)
fn_dataset = fn.__call__(dataset)
assert not fn_dataset.isna().any().any()
# Then you can use it wth DataHandler;
# NOTE: please note that the data processors are missing!!! You should add based on your requirements