Skip to content

Commit

Permalink
fix: sort values before the shift function (#151)
Browse files Browse the repository at this point in the history
* Sort values before the shift function

* Changing version to 0.12.0
  • Loading branch information
danielapinho authored Feb 6, 2024
1 parent 6c22bff commit f006174
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion cluster_experiments/washover.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ def washover(
# Cluster columns that do not involve time
non_time_cols = list(set(cluster_cols) - set([truncated_time_col]))
# For each cluster, we need to check if treatment has changed wrt last time
df_agg = df.drop_duplicates(subset=cluster_cols + [treatment_col]).copy()
df_agg = df.sort_values([original_time_col]).copy()
df_agg = df_agg.drop_duplicates(subset=cluster_cols + [treatment_col])
df_agg["__changed"] = (
df_agg.groupby(non_time_cols)[treatment_col].shift(1)
!= df_agg[treatment_col]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

setup(
name="cluster_experiments",
version="0.11.0",
version="0.12.0",
packages=find_packages(),
extras_require={
"dev": dev_packages,
Expand Down

0 comments on commit f006174

Please sign in to comment.