extracts a given number of characters from the left side of string paramater
Solution 1:
Try this:
df["ID"]=df.loc[:,"ID"].str[0:4]
Example:
df = pd.DataFrame({"ID": ["abcdefg", "abcdefg", "abcdefg"], "b": ["abcdefg", "abcdefg", "abcdefg"]})
df["ID"]=df.loc[:,"ID"].str[0:4]