[Pandas-dev] Consensus on pct_change

Tensortable.com contribute at tensortable.com
Mon Jul 15 16:21:35 EDT 2019


Yeah, me too..

--
 Terji Petersen



On Mon, Jul 15, 2019, at 4:18 PM, Tom Augspurger wrote:
> I'm OK with the way things currently are.
> 
> 
> On Fri, Jul 12, 2019 at 3:46 AM Matthew Brett <matthew.brett at gmail.com> wrote:
>> Hi,
>> 
>>  On Thu, Jul 11, 2019 at 1:23 PM Sam Steingold <sds at gnu.org> wrote:
>>  >
>>  > IMO the correct view is that "percent" vs ""
>>  >
>>  > > * Matthew Brett <znggurj.oergg at tznvy.pbz> [2019-07-10 07:32:51 -0700]:
>>  > >
>>  > > Pandas thinks that the percent change from 1 to 1.1 is 0.1, but I
>>  > > think most of us would agree that this is incorrect - the *percent*
>>  > > change is 10.
>>  >
>>  > I think that the _relative change_ from 2 to 2.2 is 0.1.
>>  >
>>  > This can be _printed_ as "0.1" or "0.1000" or "10%" or "10.000%".
>>  > IOW, "percent" is a _unit_, not a separate concept, so the difference
>>  > between "0.1" and "10%" is like the difference between 100m and 0.1km -
>>  > same value, different printed representations.
>>  >
>>  > Thus I think it is never a good idea for a _function_ to return its
>>  > value in percentage points.
>>  > Instead of `pct_change` we need `relative_change` and it should be
>>  > possible to specify how the resulting values are to be printed
>>  > (as raw decimals, percentages, "per mille" or something else).
>>  > in different situations ad hoc or by default.
>> 
>>  Thank you - yes - this is an excellent analysis.
>> 
>>  It's as if there was a function "distance_in_meters" and in fact it
>>  returns distance in centimeters. It represents the same thing, but
>>  the answer is incorrect, given the function name.
>> 
>>  I know that backcompatibility requires pct_change stay, but I'd like
>>  to repropose my option 3, which is to add `relative_change` or
>>  `prop_change` (to taste), and deprecate `pct_change`.
>> 
>>  Cheers,
>> 
>>  Matthew
>>  _______________________________________________
>>  Pandas-dev mailing list
>> Pandas-dev at python.org
>> https://mail.python.org/mailman/listinfo/pandas-dev
> _______________________________________________
> Pandas-dev mailing list
> Pandas-dev at python.org
> https://mail.python.org/mailman/listinfo/pandas-dev
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pandas-dev/attachments/20190715/71020b8f/attachment.html>


More information about the Pandas-dev mailing list