-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fixed a problem with multi index caused by the default value of groupkey #1917
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -78,13 +78,15 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break changes
@@ -29,7 +29,7 @@ def _create_ts_slices(index, seq_len): | |||
assert index.is_lexsorted(), "index should be sorted" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break changes.
@@ -19,9 +19,9 @@ def generate_order(stock: str, start_idx: int, end_idx: int) -> bool: | |||
|
|||
df["date"] = df["datetime"].dt.date.astype("datetime64") | |||
df = df.set_index(["instrument", "datetime", "date"]) | |||
df = df.groupby("date").take(range(start_idx, end_idx)).droplevel(level=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break changes
@@ -26,7 +26,7 @@ readme = {file = "README.md", content-type = "text/markdown"} | |||
dependencies = [ | |||
"pyyaml", | |||
"numpy", | |||
"pandas", | |||
"pandas>=2.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first version that we have group_keys.
@@ -38,7 +38,7 @@ def _group_return(pred_label: pd.DataFrame = None, reverse: bool = False, N: int | |||
t_df = pd.DataFrame( | |||
{ | |||
"Group%d" | |||
% (i + 1): pred_label_drop.groupby(level="datetime")["label"].apply( | |||
% (i + 1): pred_label_drop.groupby(level="datetime", group_keys=False)["label"].apply( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plot
Description
Motivation and Context
How Has This Been Tested?
pytest qlib/tests/test_all_pipeline.py
under upper directory ofqlib
.Screenshots of Test Results (if appropriate):
Types of changes