PageRenderTime 42ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/notify_user/pymodules/python2.7/lib/python/statsmodels-0.5.0-py2.7-linux-x86_64.egg/statsmodels/datasets/strikes/data.py

https://gitlab.com/pooja043/Globus_Docker_4
Python | 70 lines | 64 code | 2 blank | 4 comment | 0 complexity | e93512f6314502ae898034480cbb2510 MD5 | raw file
  1. #! /usr/bin/env python
  2. """U.S. Strike Duration Data"""
  3. __docformat__ = 'restructuredtext'
  4. COPYRIGHT = """This is public domain."""
  5. TITLE = __doc__
  6. SOURCE = """
  7. This is a subset of the data used in Kennan (1985). It was originally
  8. published by the Bureau of Labor Statistics.
  9. ::
  10. Kennan, J. 1985. "The duration of contract strikes in US manufacturing.
  11. `Journal of Econometrics` 28.1, 5-28.
  12. """
  13. DESCRSHORT = """Contains data on the length of strikes in US manufacturing and
  14. unanticipated industrial production."""
  15. DESCRLONG = """Contains data on the length of strikes in US manufacturing and
  16. unanticipated industrial production. The data is a subset of the data originally
  17. used by Kennan. The data here is data for the months of June only to avoid
  18. seasonal issues."""
  19. #suggested notes
  20. NOTE = """
  21. Number of observations - 62
  22. Number of variables - 2
  23. Variable name definitions::
  24. duration - duration of the strike in days
  25. iprod - unanticipated industrial production
  26. """
  27. from numpy import recfromtxt, column_stack, array
  28. from statsmodels.datasets import utils as du
  29. from os.path import dirname, abspath
  30. def load():
  31. """
  32. Load the strikes data and return a Dataset class instance.
  33. Returns
  34. -------
  35. Dataset instance:
  36. See DATASET_PROPOSAL.txt for more information.
  37. """
  38. data = _get_data()
  39. return du.process_recarray(data, endog_idx=0, dtype=float)
  40. def load_pandas():
  41. """
  42. Load the strikes data and return a Dataset class instance.
  43. Returns
  44. -------
  45. Dataset instance:
  46. See DATASET_PROPOSAL.txt for more information.
  47. """
  48. data = _get_data()
  49. return du.process_recarray_pandas(data, endog_idx=0, dtype=float)
  50. def _get_data():
  51. filepath = dirname(abspath(__file__))
  52. data = recfromtxt(open(filepath + '/strikes.csv', 'rb'), delimiter=",",
  53. names=True, dtype=float)
  54. return data