From 559eb4b78d50294e7e56f67e412cd208b96364c1 Mon Sep 17 00:00:00 2001 From: abonte <6319051+abonte@users.noreply.github.com> Date: Fri, 6 Jan 2023 18:11:38 +0100 Subject: [PATCH 1/3] DOC: add example to Interval.mid docstring GH15580 --- pandas/_libs/interval.pyx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/_libs/interval.pyx b/pandas/_libs/interval.pyx index fc2c486173b9d..7b9d10faf38bd 100644 --- a/pandas/_libs/interval.pyx +++ b/pandas/_libs/interval.pyx @@ -107,6 +107,12 @@ cdef class IntervalMixin: def mid(self): """ Return the midpoint of the Interval. + + Examples + -------- + >>> iv.Interval(0, 5) + >>> iv.mid + 2.5 """ try: return 0.5 * (self.left + self.right) From 9b9cb1dfbfcb8acc1676ce4f5877fdb4b3f92451 Mon Sep 17 00:00:00 2001 From: abonte <6319051+abonte@users.noreply.github.com> Date: Fri, 6 Jan 2023 18:58:18 +0100 Subject: [PATCH 2/3] fix newline --- pandas/_libs/interval.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/interval.pyx b/pandas/_libs/interval.pyx index 7b9d10faf38bd..fce27776607fa 100644 --- a/pandas/_libs/interval.pyx +++ b/pandas/_libs/interval.pyx @@ -107,7 +107,7 @@ cdef class IntervalMixin: def mid(self): """ Return the midpoint of the Interval. - + Examples -------- >>> iv.Interval(0, 5) From 409d5ef27cdf9be25e2bc65991053ffd44297495 Mon Sep 17 00:00:00 2001 From: Andrea Bontempelli Date: Fri, 6 Jan 2023 19:37:05 +0100 Subject: [PATCH 3/3] fix example --- pandas/_libs/interval.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/_libs/interval.pyx b/pandas/_libs/interval.pyx index fce27776607fa..bb25db0ee1a7f 100644 --- a/pandas/_libs/interval.pyx +++ b/pandas/_libs/interval.pyx @@ -110,7 +110,7 @@ cdef class IntervalMixin: Examples -------- - >>> iv.Interval(0, 5) + >>> iv = pd.Interval(0, 5) >>> iv.mid 2.5 """