Is there a way to subtract 3 from every digit of a number?

Avi Gross avigross at verizon.net
Sun Feb 21 09:49:55 EST 2021


Chris,

I admit I must have missed that. I was trying to understand the overall request. I do most of my data.frame work in another language 😉

I will say that there are many problems that live at various levels. The original request could have been about how o covert a 1-digit integer which would have been simple enough. Instead it asked for any integer to be viewed in some way as a collection of single digits and manipulated individually. What we have now in effect with a column of a data.frame is a collection of those collections. If next he askes to convert all columns of the data.frame, we get to a collection of collections of collections 😉

But realistically, some of those collections already have methods in place so no need for something like writing code nesting loops within loops within loops.

I deleted all the messages and I am asking myself if anyone else provided advice or actual code that zoomed in one how to do it to a series. You clearly saw it.

-----Original Message-----
From: Python-list <python-list-bounces+avigross=verizon.net at python.org> On Behalf Of Chris Angelico
Sent: Sunday, February 21, 2021 9:41 AM
Cc: Python <python-list at python.org>
Subject: Re: Is there a way to subtract 3 from every digit of a number?

On Mon, Feb 22, 2021 at 1:39 AM Avi Gross via Python-list <python-list at python.org> wrote:
> But you just moved the goalpost by talking about using a data.frame as 
> that (and I assume numpy and pandas) are not very basic Python.

Given that the original post mentioned a pd.Series, I don't know how far the goalposts actually moved :)

ChrisA
--
https://mail.python.org/mailman/listinfo/python-list



More information about the Python-list mailing list