Pandas FutureWarning: Columnar iteration over characters will be deprecated in future releases

That's not entirely correct, plus the trailing .str does not make sense. Since split with expand returns a DataFrame, this is easier:

df[['A', 'B']] = df['AB'].str.split(' ', n=1, expand=True)

Your existing method without expand returns a single Series with a list of columns. I'm not sure what version of pandas used to work with your code but AFAIK you'll need to make some tweaks for this to work with pandas (>= 1.0) today. Assignment in this way is tedious but still possible.

s = df['AB'].str.split(' ', n=1)
df['A'], df['B'] = s.str[0], s.str[1]

I prefer the expand solution as it's a line shorter.


Or we do

df['A'], df['B']=zip(*df['AB'].str.split(' ').tolist())
df
    AB  A  B
0  A B  A  B
1  A B  A  B
2  A B  A  B
3  A B  A  B