datafest competition 2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
661 B

  1. import pandas as pd
  2. # read in CSV
  3. df = pd.read_csv('cleaned/wellness.csv')
  4. def vectorize_mult(column, dictionary, file=None):
  5. newCol = column + "Num"
  6. df[newCol] = df[column].map(dictionary)
  7. if file is not None:
  8. df.to_csv('cleaned/{}.csv'.format(file))
  9. vectorize_mult("USGMeasurement", {"No": 0, "Yes": 1}, "wellness")
  10. """
  11. for i, value in df["TrainingReadiness"].iteritems():
  12. if pd.notna(value):
  13. value = value.split("%")[0]
  14. value = float(value) * (1/100)
  15. value = round(value, 2)
  16. df.set_value(i, "TrainingReadinessNum", value)
  17. print(value)
  18. df.to_csv('cleaned/{}.csv'.format("wellness"))
  19. """