Skip to content

Commit a6a1751

Browse files
committed
add Fillna test
1 parent ae6d812 commit a6a1751

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ description = "A Quantitative-research Platform"
2323
requires-python = ">=3.8.0"
2424
readme = {file = "README.md", content-type = "text/markdown"}
2525

26-
# On 2025-04-02 osqp released version 1.0.2, osqp is used as a dependency for cvxpy.
27-
# It would lead to errors installing qlib, so we limited the version of osqp.
28-
# refs: https://github.com/osqp/osqp/issues/728
2926
dependencies = [
3027
"pyyaml",
3128
"numpy",
@@ -42,7 +39,6 @@ dependencies = [
4239
"loguru",
4340
"lightgbm",
4441
"gym",
45-
"osqp<1.0.2",
4642
"cvxpy",
4743
"joblib",
4844
"matplotlib",

qlib/data/dataset/processor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def __call__(self, df):
196196
# nan_select[:, ~df.columns.isin(cols)] = False
197197
# df.values[nan_select] = self.fill_value
198198

199-
df[self.fields_group] = df[self.fields_group].fillna(0)
199+
df[self.fields_group] = df[self.fields_group].fillna(self.fill_value)
200200
return df
201201

202202

tests/data_mid_layer_tests/test_dataloader.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from qlib.data.dataset.loader import NestedDataLoader, QlibDataLoader
1111
from qlib.data.dataset.handler import DataHandlerLP
1212
from qlib.contrib.data.loader import Alpha158DL, Alpha360DL
13+
from qlib.data.dataset.processor import Fillna
1314
from qlib.data import D
1415

1516

@@ -45,6 +46,13 @@ def test_nested_data_loader(self):
4546

4647
assert "LABEL0" in columns_list
4748

49+
assert dataset.isna().any().any()
50+
51+
fn = Fillna(fields_group="feature", fill_value=0)
52+
fn_dataset = fn.__call__(dataset)
53+
54+
assert not fn_dataset.isna().any().any()
55+
4856
# Then you can use it wth DataHandler;
4957
# NOTE: please note that the data processors are missing!!! You should add based on your requirements
5058

0 commit comments

Comments
 (0)