Every line of 'pandas ffill' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
114 def panel_fillna(panel, type="bfill"): 115 """ 116 fill nan along the 3rd axis 117 :param panel: the panel to be filled 118 :param type: bfill or ffill 119 """ 120 frames = {} 121 for item in panel.items: 122 if type == "both": 123 frames[item] = panel.loc[item].fillna(axis=1, method="bfill").\ 124 fillna(axis=1, method="ffill") 125 else: 126 frames[item] = panel.loc[item].fillna(axis=1, method=type) 127 return pd.Panel(frames)