Skip to content

DOC: remove warnings in panel.apply docs (GH6087) #6089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 25, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ fact, this expression is False:
(df+df == df*2).all()

Notice that the boolean DataFrame ``df+df == df*2`` contains some False values!
That is because NaNs do not compare as equals:
That is because NaNs do not compare as equals:

.. ipython:: python

Expand Down Expand Up @@ -727,7 +727,7 @@ Apply can also accept multiple axes in the ``axis`` argument. This will pass a

.. ipython:: python

f = lambda x: (x-x.mean(1)/x.std(1))
f = lambda x: ((x.T-x.mean(1))/x.std(1)).T

result = panel.apply(f, axis = ['items','major_axis'])
result
Expand Down
2 changes: 1 addition & 1 deletion doc/source/v0.13.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Enhancements

.. ipython:: python

f = lambda x: (x-x.mean(1)/x.std(1))
f = lambda x: ((x.T-x.mean(1))/x.std(1)).T

result = panel.apply(f, axis = ['items','major_axis'])
result
Expand Down
6 changes: 6 additions & 0 deletions pandas/io/tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,16 @@ def test_get_quote_stringlist(self):

@network
def test_get_components_dow_jones(self):
raise nose.SkipTest('unreliable test, receive partial components back for dow_jones')

df = web.get_components_yahoo('^DJI') #Dow Jones
assert isinstance(df, pd.DataFrame)
self.assertEqual(len(df), 30)

@network
def test_get_components_dax(self):
raise nose.SkipTest('unreliable test, receive partial components back for dax')

df = web.get_components_yahoo('^GDAXI') #DAX
assert isinstance(df, pd.DataFrame)
self.assertEqual(len(df), 30)
Expand All @@ -166,6 +170,8 @@ def test_get_components_dax(self):
def test_get_components_nasdaq_100(self):
"""as of 7/12/13 the conditional will test false because the link is
invalid"""
raise nose.SkipTest('unreliable test, receive partial components back for nasdaq_100')

df = web.get_components_yahoo('^NDX') #NASDAQ-100
assert isinstance(df, pd.DataFrame)

Expand Down
10 changes: 6 additions & 4 deletions pandas/tests/test_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1146,11 +1146,13 @@ def test_apply_slabs(self):
assert_frame_equal(result,expected)

# transforms
f = lambda x: (x-x.mean(1)/x.std(1))
f = lambda x: ((x.T-x.mean(1))/x.std(1)).T

result = self.panel.apply(f, axis = ['items','major_axis'])
expected = Panel(dict([ (ax,f(self.panel.loc[:,:,ax])) for ax in self.panel.minor_axis ]))
assert_panel_equal(result,expected)
# make sure that we don't trigger any warnings
with tm.assert_produces_warning(False):
result = self.panel.apply(f, axis = ['items','major_axis'])
expected = Panel(dict([ (ax,f(self.panel.loc[:,:,ax])) for ax in self.panel.minor_axis ]))
assert_panel_equal(result,expected)

result = self.panel.apply(f, axis = ['major_axis','minor_axis'])
expected = Panel(dict([ (ax,f(self.panel.loc[ax])) for ax in self.panel.items ]))
Expand Down