I have dataframe df_ip_month
and am trying to split the column detail EOBs
into multiple columns on the same row for each Account
such that this
becomes this
The code I am trying to use is
df_ip_month[['eob1','eob2','eob3','eob4','eob5','eob6']] = df_ip_month['detail EOBs'].str.split(expand=True)
However, no output is generated, only the following error
ValueError: Columns must be same length as key
How come?
Here is the dataset
df_ip_month = pd.DataFrame({'Account': ['H5000570011700','H5000484349900','H5000500029400','H5000502860000','H5000631774400','H5000619680500',
'H5000587425100','H5000630746300','H5000632095500','H5000505467800','H5000558994900','H5000623617700',
'H5000539983300','H5000559033600','H5000570061901','H5000513787300','H5000562451100','H5000568554900'],
'detail EOBs': ['','','','','','5002','','5002 1442','','5003','','','','5002 3035 9932 3343 3021 2312','','','5003 3035 9932','']})