Guest User

Untitled

a guest
May 27th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. def countPred_eda(train_data, variableName, targetVariable):
  2. print(train_data[variableName].describe())
  3. return ggplot(train_data) +
  4. aes(targetVariable, variableName, fill = targetVariable) +
  5. geom_boxplot(alpha = .8) +
  6. labs(x = targetVariable, y = variableName) +
  7. ggtitle("Churn ratio with number_customer_service_calls ")
  8.  
  9. countPred_eda(train_data, number_customer_service_calls,churn)
  10.  
  11. count 3333.000000
  12. mean 1.562856
  13. std 1.315491
  14. min 0.000000
  15. 25% 1.000000
  16. 50% 1.000000
  17. 75% 2.000000
  18. max 9.000000
  19. Name: number_customer_service_calls, dtype: float64
  20. ---------------------------------------------------------------------------
  21. TypeError Traceback (most recent call last)
  22. ~AppDataLocalcondacondaenvsggpy36libsite-packagesIPythoncoreformatters.py in __call__(self, obj)
  23. 700 type_pprinters=self.type_printers,
  24. 701 deferred_pprinters=self.deferred_printers)
  25. --> 702 printer.pretty(obj)
  26. 703 printer.flush()
  27. 704 return stream.getvalue()
  28.  
  29. ~AppDataLocalcondacondaenvsggpy36libsite-packagesIPythonlibpretty.py in pretty(self, obj)
  30. 398 if cls is not object
  31. 399 and callable(cls.__dict__.get('__repr__')):
  32. --> 400 return _repr_pprint(obj, self, cycle)
  33. 401
  34. 402 return _default_pprint(obj, self, cycle)
  35.  
  36. ~AppDataLocalcondacondaenvsggpy36libsite-packagesIPythonlibpretty.py in _repr_pprint(obj, p, cycle)
  37. 693 """A pprint that just redirects to the normal repr function."""
  38. 694 # Find newlines and replace them with p.break_()
  39. --> 695 output = repr(obj)
  40. 696 for idx,output_line in enumerate(output.splitlines()):
  41. 697 if idx:
  42.  
  43. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineggplot.py in __repr__(self)
  44. 84 Print/show the plot
  45. 85 """
  46. ---> 86 self.draw()
  47. 87 plt.show()
  48. 88 return '<ggplot: (%d)>' % self.__hash__()
  49.  
  50. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineggplot.py in draw(self, return_ggplot)
  51. 201 if self.figure is not None:
  52. 202 plt.close(self.figure)
  53. --> 203 raise err
  54. 204
  55. 205 if return_ggplot:
  56.  
  57. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineggplot.py in draw(self, return_ggplot)
  58. 193 self._draw_facet_labels()
  59. 194 self._draw_labels()
  60. --> 195 self._draw_legend()
  61. 196 self._draw_title()
  62. 197 self._draw_watermarks()
  63.  
  64. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineggplot.py in _draw_legend(self)
  65. 396 Draw legend onto the figure
  66. 397 """
  67. --> 398 legend_box = self.guides.build(self)
  68. 399 if not legend_box:
  69. 400 return
  70.  
  71. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineguidesguides.py in build(self, plot)
  72. 133 self.spacing = 10
  73. 134
  74. --> 135 gdefs = self.train(plot)
  75. 136 if not gdefs:
  76. 137 return
  77.  
  78. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineguidesguides.py in train(self, plot)
  79. 203 # so Guides (i.e., the container of guides)
  80. 204 # need not to know about them
  81. --> 205 guide = guide.train(scale)
  82. 206
  83. 207 if guide is not None:
  84.  
  85. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotnineguidesguide_colorbar.py in train(self, scale)
  86. 76 # position of ticks
  87. 77 limits = scale.limits
  88. ---> 78 breaks = scale.get_breaks(strict=True)
  89. 79 breaks = np.asarray(breaks)
  90. 80 breaks = breaks[~np.isnan(breaks)]
  91.  
  92. ~AppDataLocalcondacondaenvsggpy36libsite-packagesplotninescalesscale.py in get_breaks(self, limits, strict)
  93. 622 # minor breaks
  94. 623 if strict:
  95. --> 624 cond = (breaks >= limits[0]) & (limits[1] >= breaks)
  96. 625 breaks = np.compress(cond, breaks)
  97. 626 return np.asarray(breaks)
  98.  
  99. TypeError: '>=' not supported between instances of 'list' and 'int
Add Comment
Please, Sign In to add comment