Utils.py 348 B

123456789101112131415161718
  1. import numpy as np
  2. def insert_values(feature_name, df, values):
  3. if feature_name =='centroid':
  4. a = np.array(values)
  5. x=[]
  6. y=[]
  7. for i in a:
  8. x.append(i[0])
  9. y.append(i[1])
  10. df['centroid_x'] = x
  11. df['centroid_y'] = y
  12. return 1
  13. df[feature_name] = values
  14. return 0