0

I have a column like this:

id       col1

 1   223.237.181.234
 2  236.235.183.239
 3  247.254.167.267
 4   238.252.153.236
 5   202.237.145.252

Now I want to split this single column into 4 columns with the help of dot . in the column like this:

id   col1_suffix1   col1_suffix2   col1_suffix3   col1_suffix4
1      223                237            181            234
2      236                235            183            239
3      247                254            167            267
john doe
  • 435
  • 1
  • 5
  • 12

1 Answers1

1
try this, 

df[['col1_suffix1','col1_suffix2','col1_suffix3','col1_suffix4']]=df['col1'].str.split('.',expand=True)

O/P:

   id             col1 col1_suffix1 col1_suffix2 col1_suffix3 col1_suffix4
0   1  223.237.181.234          223          237          181          234
1   2  236.235.183.239          236          235          183          239
2   3  247.254.167.267          247          254          167          267
3   4  238.252.153.236          238          252          153          236
4   5  202.237.145.252          202          237          145          252
Mohamed Thasin ah
  • 10,754
  • 11
  • 52
  • 111