yes absolutely, there is pandas functionality for this.  that can be moved because it is called rarely.