Skip to content

Commit e7a1b5e

Browse files
authored
fix col name error when fetch data (#1904)
* fix col name error when fetch data * fix col name error when fetch data * fix install qlib error * optimize code * optimize code * optimize code
1 parent 67feeae commit e7a1b5e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ 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
2629
dependencies = [
2730
"pyyaml",
2831
"numpy",
@@ -39,6 +42,7 @@ dependencies = [
3942
"loguru",
4043
"lightgbm",
4144
"gym",
45+
"osqp<1.0.2",
4246
"cvxpy",
4347
"joblib",
4448
"matplotlib",

qlib/data/dataset/loader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,10 @@ def load(self, instruments=None, start_time=None, end_time=None) -> pd.DataFrame
339339
if df_full is None:
340340
df_full = df_current
341341
else:
342+
current_columns = df_current.columns.tolist()
343+
full_columns = df_full.columns.tolist()
344+
columns_to_drop = [col for col in current_columns if col in full_columns]
345+
df_full.drop(columns=columns_to_drop, inplace=True)
342346
df_full = pd.merge(df_full, df_current, left_index=True, right_index=True, how=self.join)
343347
return df_full.sort_index(axis=1)
344348

0 commit comments

Comments
 (0)