A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/12533 below:

Allow .where to accept callable as condition · Issue #12533 · pandas-dev/pandas · GitHub

Code Sample, a copy-pastable example if possible

Allow .where and .mask to accept callable as cond. This is useful if DataFrame is changed during method chaining.

df = pd.DataFrame(np.random.randn(2, 2))
df.where(lambda x: x > 0)
# currently raises ValueError
Expected Output

Should be the same as:

df.where(df > 0)
#           0         1
#0  0.689202       NaN
#1       NaN  0.261644

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4