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.

22 lines
462 B

  1. import pandas as pd
  2. # read in CSV
  3. df = pd.read_csv('cleaned/dirty_wellness.csv')
  4. def vectorize_mult(column, dictionary, file=None):
  5. """
  6. Handles vectorizing
  7. :param column:
  8. :param dictionary:
  9. :param file:
  10. :return:
  11. """
  12. newCol = column + "Num"
  13. df[newCol] = df[column].map(dictionary)
  14. if file is not None:
  15. df.to_csv('cleaned/{}.csv'.format(file))
  16. vectorize_mult("USGMeasurement", {"No": 0, "Yes": 1}, "wellness")