Skip to content

GH #14499 Panel.ffill ignores axis parameter and fill along axis=1 #14528

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

Closed
wants to merge 1 commit into from

Conversation

Tux1
Copy link
Contributor

@Tux1 Tux1 commented Oct 28, 2016

for col, s in self.iteritems()])
new_obj = self._constructor.\
from_dict(result).__finalize__(self)
new_data = new_obj._data

def test_ffill_bfill_axis(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@Tux1 Tux1 force-pushed the panel-ffill-axis-propagation branch from 45247b7 to 687869c Compare October 28, 2016 16:10
@Tux1 Tux1 closed this Oct 28, 2016
@Tux1 Tux1 deleted the panel-ffill-axis-propagation branch October 28, 2016 16:11
@Tux1 Tux1 restored the panel-ffill-axis-propagation branch October 28, 2016 16:11
@Tux1 Tux1 reopened this Oct 28, 2016
@Tux1 Tux1 force-pushed the panel-ffill-axis-propagation branch 4 times, most recently from 28712bd to 4fb4dc9 Compare November 2, 2016 13:58
@Tux1
Copy link
Contributor Author

Tux1 commented Nov 2, 2016

handle case where axis=0, tests added for every case and passed, whatsnew added

@codecov-io
Copy link

codecov-io commented Nov 2, 2016

Current coverage is 84.65% (diff: 100%)

Merging #14528 into master will increase coverage by <.01%

@@             master     #14528   diff @@
==========================================
  Files           144        144          
  Lines         51030      51039     +9   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43198      43208    +10   
+ Misses         7832       7831     -1   
  Partials          0          0          

Powered by Codecov. Last update 8b497e4...5fdf296

@jreback jreback added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Panel labels Nov 2, 2016
@Tux1
Copy link
Contributor Author

Tux1 commented Nov 3, 2016

@jreback you're okay with this pr ?

is not scalar and ``values`` is not specified (:issue:`14380`)

- Bug in ``pd.Panel.ffill`` where ``axis`` was not propagated (:issue:`14499`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this to the 0.20.0 file? (0.19.1 is released in the meantime)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -1475,7 +1475,7 @@ def test_fillna(self):

panel = self.panel.copy()
panel['str'] = 'foo'

print(panel)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left over

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

result = dict([(col, s.fillna(method=method, value=value))
for col, s in self.iteritems()])
if axis == 0:
frame = self.swapaxes(0, 1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question (not too familiar with Panels): swapping the axes here can potentially cause dtypes to change? (ints upcast to float, or numeric upcast to object when you have mixed dtypes)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Let me check

@Tux1 Tux1 force-pushed the panel-ffill-axis-propagation branch from 4fb4dc9 to 2119035 Compare November 12, 2016 15:24
@jreback
Copy link
Contributor

jreback commented Dec 21, 2016

@Tux1 can you rebase / update

@Tux1 Tux1 force-pushed the panel-ffill-axis-propagation branch from 2119035 to 5fdf296 Compare December 22, 2016 13:47
@Tux1
Copy link
Contributor Author

Tux1 commented Dec 22, 2016 via email

# can detect if something was set (e.g. in groupby) (GH9221)
if axis is None:
axis = 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

axis = self._stat_axis_number give the correct default

axis2d = 0
else:
frame = self
axis2d = axis - 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

axis == 2?

downcast=downcast)
if self._is_mixed_type and axis == 1:
if inplace:
raise NotImplementedError()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a message to the NotImplementedError

b0 = a.copy()
b1 = a.copy()
b2 = a.copy()
a['a'].loc[1, 1] = np.nan
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set using full .loc, not chained indexing, e.g. f0.loc['a', 1, 1] = np.nan


# method='ffill'
# axis=0
assert_panel_equal(a.ffill(axis=0), f0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make these expected before each statement, e.g.

result = a.ffill(axis=0)
expected = ......
assert_panel_equal(result, expected)

# method='bfill'
# axis=2
assert_panel_equal(a.bfill(axis=2), b2)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally also tests with a panel that has a non-numeric type as well (IOW, add a string to the above example); this should be a separate set of tests.

@jreback
Copy link
Contributor

jreback commented Mar 20, 2017

pls comment if youd like to update / rebase and continue

@jreback jreback closed this Mar 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate
Projects
None yet
4 participants