summaryrefslogtreecommitdiff
path: root/gnu/packages/python-science.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/python-science.scm')
-rw-r--r--gnu/packages/python-science.scm98
1 files changed, 96 insertions, 2 deletions
diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 93fc63c2e7c..4a262ec7937 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -1,10 +1,13 @@
1;;; GNU Guix --- Functional package management for GNU 1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> 2;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net>
3;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> 3;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
4;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
4;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com> 5;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
5;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> 6;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
6;;; Copyright © 2016, 2018 Marius Bakke <mbakke@fastmail.com> 7;;; Copyright © 2016, 2017, 2018, 2019 Marius Bakke <mbakke@fastmail.com>
7;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr> 8;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
10;;; Copyright © 2019 Giacomo Leidi <goodoldpaul@autistici.org>
8;;; 11;;;
9;;; This file is part of GNU Guix. 12;;; This file is part of GNU Guix.
10;;; 13;;;
@@ -30,8 +33,10 @@
30 #:use-module (gnu packages maths) 33 #:use-module (gnu packages maths)
31 #:use-module (gnu packages perl) 34 #:use-module (gnu packages perl)
32 #:use-module (gnu packages python) 35 #:use-module (gnu packages python)
36 #:use-module (gnu packages python-web)
33 #:use-module (gnu packages python-xyz) 37 #:use-module (gnu packages python-xyz)
34 #:use-module (gnu packages sphinx) 38 #:use-module (gnu packages sphinx)
39 #:use-module (gnu packages time)
35 #:use-module (guix packages) 40 #:use-module (guix packages)
36 #:use-module (guix download) 41 #:use-module (guix download)
37 #:use-module (guix utils) 42 #:use-module (guix utils)
@@ -191,3 +196,92 @@ routines such as routines for numerical integration and optimization.")
191 196
192(define-public python2-scikit-image 197(define-public python2-scikit-image
193 (package-with-python2 python-scikit-image)) 198 (package-with-python2 python-scikit-image))
199
200(define-public python-pandas
201 (package
202 (name "python-pandas")
203 (version "0.25.2")
204 (source
205 (origin
206 (method url-fetch)
207 (uri (pypi-uri "pandas" version))
208 (sha256
209 (base32 "1gp2pvzdiakvgjmykdzdlzrsfbg4vjm49jjdl9s0ha0a3yfs34fa"))))
210 (build-system python-build-system)
211 (arguments
212 `(#:modules ((guix build utils)
213 (guix build python-build-system)
214 (ice-9 ftw)
215 (srfi srfi-26))
216 #:phases (modify-phases %standard-phases
217 (add-after 'unpack 'patch-which
218 (lambda* (#:key inputs #:allow-other-keys)
219 (let ((which (assoc-ref inputs "which")))
220 (substitute* "pandas/io/clipboard/__init__.py"
221 (("^CHECK_CMD = .*")
222 (string-append "CHECK_CMD = \"" which "\"\n"))))
223 #t))
224 (replace 'check
225 (lambda _
226 (let ((build-directory
227 (string-append
228 (getcwd) "/build/"
229 (car (scandir "build"
230 (cut string-prefix? "lib." <>))))))
231 ;; Disable the "strict data files" option which causes
232 ;; the build to error out if required data files are
233 ;; not available (as is the case with PyPI archives).
234 (substitute* "setup.cfg"
235 (("addopts = --strict-data-files") "addopts = "))
236 (with-directory-excursion build-directory
237 ;; Delete tests that require "moto" which is not yet
238 ;; in Guix.
239 (for-each delete-file
240 '("pandas/tests/io/conftest.py"
241 "pandas/tests/io/json/test_compression.py"
242 "pandas/tests/io/parser/test_network.py"
243 "pandas/tests/io/test_parquet.py"))
244 (invoke "pytest" "-vv" "pandas" "--skip-slow"
245 "--skip-network" "-k"
246 ;; XXX: Due to the deleted tests above.
247 "not test_read_s3_jsonl"))))))))
248 (propagated-inputs
249 `(("python-numpy" ,python-numpy)
250 ("python-openpyxl" ,python-openpyxl)
251 ("python-pytz" ,python-pytz)
252 ("python-dateutil" ,python-dateutil)
253 ("python-xlrd" ,python-xlrd)))
254 (inputs
255 `(("which" ,which)))
256 (native-inputs
257 `(("python-cython" ,python-cython)
258 ("python-beautifulsoup4" ,python-beautifulsoup4)
259 ("python-lxml" ,python-lxml)
260 ("python-html5lib" ,python-html5lib)
261 ("python-nose" ,python-nose)
262 ("python-pytest" ,python-pytest)
263 ("python-pytest-mock" ,python-pytest-mock)))
264 (home-page "https://pandas.pydata.org")
265 (synopsis "Data structures for data analysis, time series, and statistics")
266 (description
267 "Pandas is a Python package providing fast, flexible, and expressive data
268structures designed to make working with structured (tabular,
269multidimensional, potentially heterogeneous) and time series data both easy
270and intuitive. It aims to be the fundamental high-level building block for
271doing practical, real world data analysis in Python.")
272 (properties `((python2-variant . ,(delay python2-pandas))))
273 (license license:bsd-3)))
274
275;; Pandas 0.24.x are the last versions that support Python 2.
276(define-public python2-pandas
277 (let ((pandas (package-with-python2
278 (strip-python2-variant python-pandas))))
279 (package/inherit
280 pandas
281 (version "0.24.2")
282 (source (origin
283 (method url-fetch)
284 (uri (pypi-uri "pandas" version))
285 (sha256
286 (base32
287 "18imlm8xbhcbwy4wa957a1fkamrcb0z988z006jpfda3ki09z4ag")))))))