IIUC, here is one option :
splits = (
df["numbers"]
.astype(str).str.findall(r"\d")
.apply(pd.Series)
.rename(columns=lambda x: f"TEST{x+1}")
)
out = df.join(splits)
Another variant
splits = (
pd.DataFrame(
df["numbers"]
.astype(str).str.findall(r"\d")
.to_list())
.rename(columns=lambda x: f"TEST{x+1}")
)
Or, as suggested by @Quang Hoang use one of those statements as the first chain of splits
:
df["numbers"].astype(str).str.extractall(r"(\d)")[0].unstack()
df["numbers"].astype(str).str.split("", expand=True).iloc[:, 1:-1]
Or simply, as pointed by @wjandrea, use this:
df["numbers"].apply(lambda n: pd.Series(list(str(n))))
Output:
print(out)
numbers TEST1 TEST2 TEST3 TEST4
0 3336 3 3 3 6
1 1020 1 0 2 0
2 5060 5 0 6 0
3 6060 6 0 6 0
4 5141 5 1 4 1
5 3121 3 1 2 1
6 1010 1 0 1 0
7 5060 5 0 6 0
8 2020 2 0 2 0
9 1030 1 0 3 0
10 1010 1 0 1 0
11 1010 1 0 1 0
12 1010 1 0 1 0
13 1121 1 1 2 1