summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-10-13 13:28:58 +0200
committerRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-10-22 17:35:13 +0200
commit37fdba7e0ba3d3bd8b3e58f55fa982aec05dc163 (patch)
tree0a8ceb8cade0f19c743c89848b08f20e9c6b7274
parent9bc08aa0cb65ef0689f06fed7b0859f9fe542ae1 (diff)
downloadguix-37fdba7e0ba3d3bd8b3e58f55fa982aec05dc163.tar.gz
gnu: Add python-statsmodels.
* gnu/packages/statistics.scm (python-statsmodels, python2-statsmodels):
  New variables.
-rw-r--r--gnu/packages/statistics.scm64
1 files changed, 64 insertions, 0 deletions
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 14920944c5..0c0464c2b9 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -989,3 +989,67 @@ building design matrices.")
          ,@(alist-delete "python-numpy"
                          (alist-delete "python-scipy"
                                        (package-propagated-inputs patsy))))))))
+
+(define-public python-statsmodels
+  (package
+    (name "python-statsmodels")
+    (version "0.6.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://pypi.python.org/packages/source/"
+                           "s/statsmodels/statsmodels-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0xn67sqr0cc1lmlhzm71352hrb4hw7g318p5ff5q97pc98vl8kmy"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; tests must be run after installation
+         (delete 'check)
+         (add-after 'unpack 'set-matplotlib-backend-to-agg
+          (lambda _
+            ;; Set the matplotlib backend to Agg to avoid problems using the
+            ;; GTK backend without a display.
+            (substitute* (find-files "statsmodels/graphics/tests" "\\.py")
+              (("import matplotlib\\.pyplot as plt" line)
+               (string-append "import matplotlib;matplotlib.use('Agg');"
+                              line)))
+            #t))
+         (add-after 'install 'check
+          (lambda _
+            (with-directory-excursion "/tmp"
+              (zero? (system* "nosetests"
+                              "--stop"
+                              "-v" "statsmodels"))))))))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-scipy" ,python-scipy)
+       ("python-pandas" ,python-pandas)
+       ("python-patsy" ,python-patsy)
+       ("python-matplotlib" ,python-matplotlib)))
+    (native-inputs
+     `(("python-cython" ,python-cython)
+       ("python-nose" ,python-nose)
+       ("python-sphinx" ,python-sphinx)))
+    (home-page "http://statsmodels.sourceforge.net/")
+    (synopsis "Statistical modeling and econometrics in Python")
+    (description
+     "Statsmodels is a Python package that provides a complement to scipy for
+statistical computations including descriptive statistics and estimation and
+inference for statistical models.")
+    (license license:bsd-3)))
+
+(define-public python2-statsmodels
+  (let ((stats (package-with-python2 python-statsmodels)))
+    (package (inherit stats)
+      (propagated-inputs
+       `(("python2-numpy" ,python2-numpy)
+         ("python2-scipy" ,python2-scipy)
+         ("python2-pandas" ,python2-pandas)
+         ("python2-patsy" ,python2-patsy)
+         ("python2-matplotlib" ,python2-matplotlib)))
+      (native-inputs
+       `(("python2-setuptools" ,python2-setuptools)
+         ,@(package-native-inputs stats))))))