you can use LooseVersion for this much easier

look in pandas/__init__ for how to use it