Skip to content

Commit 0684419

Browse files
authored
Address pandas warning about deprecated DataFrameGroupBy.apply default (#7235)
* Address pandas warning about deprecated DataFrameGroupBy.apply default The current default is to pass grouping columns to the apply function, which in our case does not use them at all. Here we exclude them with `include_groups=False` adopting the new behavior. Adding temporary check that the new output is the same. * Clean up temporary assertion (all tests passed)
1 parent 0a326d0 commit 0684419

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cirq-core/cirq/experiments/xeb_fitting.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def _try_keep(k):
138138
else:
139139
groupby_names = ['cycle_depth']
140140

141-
return df.groupby(groupby_names).apply(per_cycle_depth).reset_index()
141+
return df.groupby(groupby_names).apply(per_cycle_depth, include_groups=False).reset_index()
142142

143143

144144
class XEBCharacterizationOptions(ABC):
@@ -702,7 +702,7 @@ def _per_pair(f1):
702702
groupby = ['layer_i', 'pair_i', 'pair']
703703
else:
704704
groupby = ['pair']
705-
return fidelities_df.groupby(groupby).apply(_per_pair)
705+
return fidelities_df.groupby(groupby).apply(_per_pair, include_groups=False)
706706

707707

708708
def before_and_after_characterization(

0 commit comments

Comments
 (0)