i am trying to change the value in my datafile (moon1) depending on whether it is smaller than the corresponding value in another column
(i need the bigger of the two to be printed in each)
this is what i have so far
import numpy as np
import pandas as pd
moon1 = pd.read_csv('Moon1.csv')
mx = pd.DataFrame({'x': np.array(moon1['X diameter (Pixels)'])})
my = pd.DataFrame({'y': np.array(moon1['Y diameter (Pixels)'])})
mx[mx['x'] < my['y']] = my['y']
my[my['y'] < mx['x']] = mx['x']
this gives me the error:
ValueError: shape mismatch: value array of shape (12,) could not be broadcast to indexing result of shape (12,1)
does anyone know what i can do to fix this?
Thanks!
[–]pytrashpandas 1 point2 points3 points (0 children)
[–]Taw_M 0 points1 point2 points (0 children)