My original ticket title was "Clarify stats module role", not deprecate. "This ticket is to split the more technical stuff (which presumably may still be used for researchers, but not for the sort of things basic R or pandas data frames would be) into a separate module where it can be taken care of." The whole notion of removing something as basic as "mean" from global namespace is not something I would support.
However, that does bring up a broader issue of who the end users of Sage are supposed to be. I understand the idea of Sage solely as a Python library like Sympy or whatever. However, not just historically have we behaved otherwise, but it seems rather opposed to the mission statement of Sage. Our goal isn't to be "best standard Python library for math" but "open-source competitor to ..." and they are stand-alone programs, by design and rightly so. (This could include having a pip-installable version, obviously.) This question is naturally not directly part of this thread, but it seems to come up fairly often. As for me, too many memories of needing warnings in Maple like "Did you remember to load the plots package via the with(plots): command?" Nils has a good quote on the ticket, "A python library is just not a very good match for what people expect from an interactive CAS, so I think it's good we have a shim layer that makes sagemath behave a little more like a traditional CAS." On Saturday, February 12, 2022 at 10:28:43 PM UTC-5 wst...@gmail.com wrote: > This happened in https://trac.sagemath.org/ticket/29662, as requested > by kcrisman. I just looked at that > ticket and added a comment about several additional examples where > deprecating mean breaks things > in subtle ways... > > On Sat, Feb 12, 2022 at 7:14 PM Samuel Lelievre > <samuel....@gmail.com> wrote: > > > > Dear sage-devel, > > > > Taking averages is a common operation, and a `mean` function > > such that `mean(xx)` returns `sum(xx) / len(xx)` regardless of > > the type of objects in the iterable `xx` is extremely convenient. > > > > For instance, for a polygon whose vertices `uu` have coordinates > > in a number field and are represented as vectors over that field, > > `mean(uu)` finds the centre of that polygon. To center the polygon > > at the origin, use `c = mean(uu)` and `vv = [u - c for u in uu]`. > > > > In Sage 9.5, using `mean` displays a warning: > > ``` > > DeprecationWarning: sage.stats.basic_stats.mean is deprecated; > > use numpy.mean or numpy.nanmean instead > > ``` > > This is after #29662 was merged in SageMath 9.5.beta1. > > > > Alas, `numpy.mean` cannot find the mean of a list of vectors > > over a number field. > > > > Of course, as a workaround, I can define > > > > def mean(xx): > > r""" > > Return the mean of this iterable. > > """ > > return sum(xx) / len(xx) > > > > and place that in an `init.sage` file in my `~/.sage` folder. > > > > Having that built into Sage is so much more convenient though. > > Can we have it back? > > > > Kind polygonal regards, --Samuel > > > > -- > > You received this message because you are subscribed to the Google > Groups "sage-devel" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to sage-devel+...@googlegroups.com. > > To view this discussion on the web visit > https://groups.google.com/d/msgid/sage-devel/60fe4b1c-db88-4caa-8d13-670b9b3edb79n%40googlegroups.com > . > > > > -- > William (http://wstein.org) > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/c7c66de5-c7b0-4003-8066-6b67a4926a78n%40googlegroups.com.