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/9736 below:

DataFrame.where does not respect axis parameter for n x n frames · Issue #9736 · pandas-dev/pandas · GitHub

In [3]: df = pd.DataFrame(np.random.randn(5, 5))

In [4]: s = pd.Series(range(5))

In [5]: df.where(df.isnull(), s, axis=0)
Out[5]:
   0  1  2  3  4
0  0  1  2  3  4
1  0  1  2  3  4
2  0  1  2  3  4
3  0  1  2  3  4
4  0  1  2  3  4

In [6]: df.where(df.isnull(), s, axis=1)
Out[6]:
   0  1  2  3  4
0  0  1  2  3  4
1  0  1  2  3  4
2  0  1  2  3  4
3  0  1  2  3  4
4  0  1  2  3  4

The right axis is used when aligning indices, but it's not used when broadcasting the aligned Series. You also get the right result if the DataFrame is not square, because core.internals.where will transpose if necessary to the get the dimensions to fit.


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