enron_outliers.py 697 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/python
  2. import pickle
  3. import sys
  4. import matplotlib.pyplot
  5. sys.path.append("../tools/")
  6. from feature_format import featureFormat, targetFeatureSplit
  7. ### read in data dictionary, convert to numpy array
  8. data_dict = pickle.load( open("../final_project/final_project_dataset.pkl", "r") )
  9. features = ["salary", "bonus"]
  10. data = featureFormat(data_dict, features)
  11. max_ = list(data_dict.keys())[list(data_dict.values()).index(max(data_dict.values()))]
  12. print (max_)
  13. ### your code below
  14. for point in data:
  15. salary = point[0]
  16. bonus = point[1]
  17. matplotlib.pyplot.scatter( salary, bonus )
  18. matplotlib.pyplot.xlabel("salary")
  19. matplotlib.pyplot.ylabel("bonus")
  20. matplotlib.pyplot.show()