The updated version will be:
df['value'].astype(str).str.join(' ').str.split(' ', expand=True)
This first introduces spaces between characters and then breaks. This is just a workaround to use str.split (perhaps, not necessarily, not sure). But this is pretty fast:
df = pd.DataFrame({'value': np.random.randint(10**7, 10**8, 10**4)}) %timeit df['value'].astype(str).str.join(' ').str.split(' ', expand=True) 10 loops, best of 3: 25.5 ms per loop %timeit df.value.astype(str).apply(list).apply(pd.Series).astype(int) 1 loop, best of 3: 1.27 s per loop %timeit df['value'].apply(lambda x: pd.Series(list(str(x)),index=range(8))) 1 loop, best of 3: 1.33 s per loop %%timeit arr = df.value.values.astype('S8') pd.DataFrame(np.fromstring(arr, dtype=np.uint8).reshape(-1,8)-48) 1000 loops, best of 3: 1.14 ms per loop
Update: Divakar's solution seems to be the fastest.
ayhan source share