How to use 'pandas ffill' in Python

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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
114def 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)

Related snippets