Skip to content

DataFrame.groupby.fillna for axis=1, no filling happens #9221

@prebenbang

Description

@prebenbang

groupby.fillna not working along column axis.

The bug exists for 15.1 and 15.2
Works for 13.1

import pandas as pd import numpy as np print pd.__version__ test = pd.DataFrame(index=pd.MultiIndex.from_product([['value1','value2'],pd.date_range('2014-01-01','2014-01-06')]), columns=pd.Index(['1','2'], name='id')) test['1'] = [np.nan, 1, np.nan, np.nan, 11, np.nan, np.nan, 2, np.nan, np.nan, 22, np.nan] test['2'] = [np.nan, 3, np.nan, np.nan, 33, np.nan, np.nan, 4, np.nan, np.nan, 44, np.nan] testT = test.T print '*' * 30 print test print '*' * 30 print test.groupby(level=0, axis=0).fillna(method='ffill') print '*' * 30 print testT print '*' * 30 print testT.groupby(level=0, axis=1).fillna(method='ffill') print '*' * 30 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions