I have defined the following function that generates as output a tuple, and I need to assign the result to two different columns of a dataframe.
The functions just tooks a x and y coordinate and converts it to a different coordinate:
plot_shot(x,y)
I have developed the following code that it works, but I am looking for a smarter solution that allows me to assign the tuple in the apply lambda line:
df_shots['temporary'] = df_shots.apply (lambda a: plot_shot(a['x'],a['y'],0,15,-3,'left','bottom'), axis=1)
df_shots['x_converted'] = df_shots['temporary'].apply (lambda x: x[0])
df_shots['y_converted'] = df_shots['temporary'].apply (lambda x: x[1])
df_shots.drop('temporary', axis=1, inplace = True)
I am assuming that this can be donde in one line instead of this.
Thanks in advance.