Skip to content

Commit d7fdc53

Browse files
authored
Merge pull request #88 from chenyangkang/debug
fix #87; compatibility with pandas 3.0
2 parents 5810f12 + f8ff490 commit d7fdc53

4 files changed

Lines changed: 9 additions & 8 deletions

File tree

.github/workflows/run_pytest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: true
1313
matrix:
14-
python-version: ["3.9", "3.10", "3.11"]
14+
python-version: ["3.9", "3.11", "3.12", "3.13"] #future: "3.14"
1515
steps:
1616
- name: Set Swap Space
1717
uses: pierotofy/set-swap-space@master

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
"Development Status :: 5 - Production/Stable",
4747
"Programming Language :: Python :: 3",
4848
"Programming Language :: Python :: 3.9",
49-
"Programming Language :: Python :: 3.10",
5049
"Programming Language :: Python :: 3.11",
5150
"Programming Language :: Python :: 3.12",
51+
"Programming Language :: Python :: 3.13",
5252
"Operating System :: Unix",
5353
"Operating System :: MacOS :: MacOS X",
5454
"Operating System :: Microsoft :: Windows",

stemflow/model/AdaSTEM.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -944,13 +944,13 @@ def find_belonged_points_and_predict(df, st_indexes_df, X_df):
944944
"stixel_calibration_point_transformed_upper_bound",
945945
]
946946
]
947-
.groupby(["ensemble_index", "unique_stixel_id"], as_index=False)
947+
.groupby(["ensemble_index", "unique_stixel_id"], as_index=False, group_keys=False)
948948
.pipe(lambda x: x[x.obj.columns]) # Explicitly select all the columns in the original df to include. To overcome the include_groups=True deprecation warning
949949
.apply(find_belonged_points_and_predict, st_indexes_df=window_X_df_indexes_only, X_df=window_X_df, include_groups=False) # although ["ensemble_index", "unique_stixel_id"] will be passed into `find_belonged_points` due to `.pipe(lambda x: x[x.obj.columns])`, the output will not have them so we still set `as_index=True` in `groupby`
950950
)
951951

952-
if len(res)>0:
953-
res = res.droplevel(0) # If using as_index=False duing groupby, pandas will automatically generate a group indexing column, so drop the indexing of the new groups
952+
# if len(res)>0:
953+
# res = res.droplevel(0) # If using as_index=False duing groupby, pandas will automatically generate a group indexing column, so drop the indexing of the new groups
954954

955955
window_prediction_list.append(res)
956956

stemflow/model/SphereAdaSTEM.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,17 +513,18 @@ def find_belonged_points(df, st_indexes_df, X_df):
513513
window_prediction = (
514514
query_results
515515
.dropna(subset="unique_stixel_id")
516-
.groupby("unique_stixel_id", as_index=False)
516+
.groupby("unique_stixel_id", as_index=False, group_keys=False)
517517
.pipe(lambda x: x[x.obj.columns])
518518
.apply(lambda stixel: self.stixel_predict(stixel), include_groups=False)
519-
.droplevel(0)
520519
)
521520
# print('window_prediction:',window_prediction)
522521
window_prediction_list.append(window_prediction)
523522

524523
if any([i is not None for i in window_prediction_list]):
525524
ensemble_prediction = pd.concat(window_prediction_list, axis=0)
526-
ensemble_prediction = ensemble_prediction.groupby("index").mean().reset_index(drop=False)
525+
ensemble_prediction = ensemble_prediction.groupby(level=0).mean()
526+
ensemble_prediction.index.name = "index"
527+
ensemble_prediction = ensemble_prediction.reset_index(drop=False)
527528
else:
528529
ensmeble_index = list(window_single_ensemble_df["ensemble_index"])[0]
529530
warnings.warn(f"No prediction for this ensemble: {ensmeble_index}")

0 commit comments

Comments
 (0)