Reputation:
╔══════╦══════╗
║ col1 ║ col2 ║
╠══════╬══════╣
║ 2 ║ NaN ║
║ 4 ║ 5 ║
║ 12 ║ 11 ║
║ 23 ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ NaN ║
║ NaN ║ NaN ║
║ NaN ║ NaN ║
║ NaN ║ NaN ║
║ 12 ║ NaN ║
║ 7 ║ 6 ║
║ 3 ║ 8 ║
╚══════╩══════╝
How can i get pandas to interpolate this to fill the values of col2 with the most recent values from col1?
Output:
╔══════╦══════╗
║ col1 ║ col2 ║
╠══════╬══════╣
║ 2 ║ 2 ║
║ 4 ║ 5 ║
║ 12 ║ 12 ║
║ 23 ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ 23 ║
║ NaN ║ 23 ║
║ 12 ║ 12 ║
║ 7 ║ 6 ║
║ 3 ║ 3 ║
╚══════╩══════╝
I'm new to pandas so if anyone has any suggestions that would be great! Thank you
Upvotes: 2
Views: 86