Skip to content

Commit

Permalink
code sample for pandas-dev#39931
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed Feb 22, 2021
1 parent 315acea commit 85ca77c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions bisect/39931.py
@@ -0,0 +1,21 @@
# BUG: Index alignment behaviour #39931

import numpy as np

import pandas as pd
import pandas.testing as tm

print(pd.__version__)

np.random.seed(1)
df = pd.DataFrame(np.random.randint(0, 100, (10, 2)), columns=["A", "B"])

mask = df["A"] >= 40

df2 = df.copy()

df2[mask] = df[mask].sort_values("A")
print(df2[mask])


tm.assert_frame_equal(df, df2)

0 comments on commit 85ca77c

Please sign in to comment.