for i in range(len('ID')):
buf = [str(x) for x in LTE_db['robot'][i].split(';')]
for j in robot_db['robot'][i]:
try:
robot_db['final'] = robot_db['ID][i] '*' robot_db['Name'][i] '*' robot_db['latitude'][i] '*' robot_db['longitude'][i] '*' buf[j]
except ValueError:
pass
How to convert data from the first table to the second? You need to do it through Pandas.
CodePudding user response:
df['robot'] = df.data.str.split(', ')
df.explode('robot')
CodePudding user response:
You may use pandas' split
method, specifying the comma as your delimiter:
df['robot'].str.split(pat = ',', expand = True)