Dataframe extension integration

This function is general enough that it could probably be moved to the `util` module.