Skip to main content
added 45 characters in body
Source Link

ThisIf you are looking to hard-code it for only 2 columns, this can be easily achieved as follows:

import pandas as pd df = pd.DataFrame() Xtext = '9 10 13 110 14 16' Y =16 '1212 1 6 1 1 2'   df['X']text = Xtext.split()   df['X'] = text[:int(len(text)/2)] df['Y'] = Y.splittext[int(len(text)/2):] 

This can be easily achieved as follows:

import pandas as pd df = pd.DataFrame() X = '9 10 13 110 14 16' Y = '12 1 6 1 1 2'   df['X'] = X.split() df['Y'] = Y.split() 

If you are looking to hard-code it for only 2 columns, this can be achieved as follows:

import pandas as pd df = pd.DataFrame() text = '9 10 13 110 14 16 12 1 6 1 1 2' text = text.split()   df['X'] = text[:int(len(text)/2)] df['Y'] = text[int(len(text)/2):] 
Source Link

This can be easily achieved as follows:

import pandas as pd df = pd.DataFrame() X = '9 10 13 110 14 16' Y = '12 1 6 1 1 2' df['X'] = X.split() df['Y'] = Y.split()