Subject: [bug#49541] [PATCH 2/2] gnu: Add python-pingouin.

From: Arun Isaac <[email-masked]>
Date: Tue, 13 Jul 2021 15:19:51 +0530

* gnu/packages/python-science.scm (python-pingouin): New variable.
---
 gnu/packages/python-science.scm | 74 +++++++++++++++++++++++++++++++++
 1 file changed, 74 insertions(+)

diff --git a/gnu/packages/python-science.scm b/gnu/packages/python-science.scm
index 1292781f2b..6fce8d2319 100644
--- a/gnu/packages/python-science.scm
+++ b/gnu/packages/python-science.scm
@@ -37,6 +37,7 @@
   #:use-module (gnu packages check)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages image-processing)
+  #:use-module (gnu packages machine-learning)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mpi)
   #:use-module (gnu packages perl)
@@ -48,6 +49,7 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages simulation)
   #:use-module (gnu packages sphinx)
+  #:use-module (gnu packages statistics)
   #:use-module (gnu packages time)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
@@ -761,3 +763,75 @@ with Pandas objects.  Pandas-flavor extends Pandas' extension API by
 of Pandas
 @end itemize")
     (license license:expat)))
+
+(define-public python-pingouin
+  (package
+    (name "python-pingouin")
+    (version "0.3.12")
+    (source
+     ;; The PyPI tarball does not contain the tests.
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/raphaelvallat/pingouin")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1ap29x54kdr19vi8qxj9g6cz2r1q4f0z7dcf6g77zwav7hf7r61a"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; On loading, Pingouin uses the outdated package to check if a newer
+         ;; version is available on PyPI. This check adds an extra dependency
+         ;; and is irrelevant to Guix users. So, disable it.
+         (add-after 'unpack 'remove-outdated-check
+           (lambda _
+             (substitute* "setup.py"
+               (("'outdated',") ""))
+             (substitute* "pingouin/__init__.py"
+               (("^from outdated[^\n]*") "")
+               (("^warn_if_outdated[^\n]*") ""))))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "pytest")))))))
+    (native-inputs
+     `(("python-pytest" ,python-pytest)
+       ("python-pytest-cov" ,python-pytest-cov)))
+    (propagated-inputs
+     `(("python-matplotlib" ,python-matplotlib)
+       ("python-mpmath" ,python-mpmath)
+       ("python-numpy" ,python-numpy)
+       ("python-pandas" ,python-pandas)
+       ("python-pandas-flavor" ,python-pandas-flavor)
+       ("python-scikit-learn" ,python-scikit-learn)
+       ("python-scipy" ,python-scipy)
+       ("python-seaborn" ,python-seaborn)
+       ("python-statsmodels" ,python-statsmodels)
+       ("python-tabulate" ,python-tabulate)))
+    (home-page "https://pingouin-stats.org/")
+    (synopsis "Statistical package for Python")
+    (description "Pingouin is a statistical package written in Python 3 and
+based mostly on Pandas and NumPy.  Its features include
+
+@itemize
+@item ANOVAs: N-ways, repeated measures, mixed, ancova
+@item Pairwise post-hocs tests (parametric and non-parametric) and pairwise
+correlations
+@item Robust, partial, distance and repeated measures correlations
+@item Linear/logistic regression and mediation analysis
+@item Bayes Factors
+@item Multivariate tests
+@item Reliability and consistency
+@item Effect sizes and power analysis
+@item Parametric/bootstrapped confidence intervals around an effect size or a
+correlation coefficient
+@item Circular statistics
+@item Chi-squared tests
+@item Plotting: Bland-Altman plot, Q-Q plot, paired plot, robust correlation,
+and more
+@end itemize")
+    (license license:gpl3)))
+
-- 
2.32.0