Replace method in pandas not giving expected result
This is pure(almost) python:

list(map(lambda x: x[0] + '.'.join(['X' * len(c) for c in x[1:].split('.')]), my_df['IP']))


Explanation:
 - Use the map to iterate over each row in my_df['IP'] column.
 - Per each IP value, split into first char and others using the x[0], x[1:]
 notation.
 - Get each part in x[1:] using the split method.
 - For each part get its length and accordingly create a string made of X's.
 - Rejoin this X's string into one string with '.' between them.  

If using python2 you dont need the list.