Re: Connecting python to DB2 database

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 3:42 PM DFS wrote: > > Having a problem with the DB2 connector > > test.py > > import ibm_db_dbi > connectstring = > 'DATABASE=xxx;HOSTNAME=localhost;PORT=5;PROTOCOL=TCPIP;UID=xxx;PWD=xxx;' > conn = ibm_db_

Connecting python to DB2 database

2021-09-02 Thread DFS
Having a problem with the DB2 connector test.py import ibm_db_dbi connectstring = 'DATABASE=xxx;HOSTNAME=localhost;PORT=5;PROTOCOL=TCPIP;UID=xxx;PWD=xxx;' conn = ibm_db_dbi.connect(connectstring,'','') curr = conn.cursor pri

Re: Python Package documentation error

2021-09-02 Thread Krishna
Hi Python Team, I think the statement "The __init__.py files are required to make Python treat directories containing the file as packages" is wrong in the documentation[1] because it is valid only for Python 2.x version not Python 3.x version. Even though it is good practice to have this file, it

Re: Scraping of Google Map to get the address of locations for given geocodes.

2021-09-02 Thread 2QdxY4RzWzUUiLuE
On 2021-09-02 at 20:12:19 -0300, Michio Suginoo wrote: > I have the following question regarding how to scrape Google Map to get > address based on a given list of geocodes. > Given a list of geocodes (latitude; longitude) of locations, I would like > to scrape municipalities of all the spots in

Re: on floating-point numbers

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 8:15 AM Dennis Lee Bieber wrote: > > On Fri, 3 Sep 2021 04:43:02 +1000, Chris Angelico > declaimed the following: > > > > >The naive summation algorithm used by sum() is compatible with a > >variety of different data types - even lists, although it's documented > >as being

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 8:01 AM Alan Gauld via Python-list wrote: > > On 02/09/2021 19:28, Chris Angelico wrote: > > >> Except for the places that don't follow the IANA scheme and/or > >> dynamically change their time settings on a whim. To be complete > >> you need the ability to manually override

Scraping of Google Map to get the address of locations for given geocodes.

2021-09-02 Thread Michio Suginoo
Dear all, I have the following question regarding how to scrape Google Map to get address based on a given list of geocodes. Given a list of geocodes (latitude; longitude) of locations, I would like to scrape municipalities of all the spots in the list. How can I do that? For example, I have la

Re: Add a method to list the current named logging levels

2021-09-02 Thread Dieter Maurer
Edward Spencer wrote at 2021-9-2 10:02 -0700: >Sometimes I like to pass the logging level up to the command line params so my >user can specific what level of logging they want. However there is no easy >method for pulling the named logging level names. > >Looking into the code, it would actually

Re: on writing a while loop for rolling two dice

2021-09-02 Thread lucas
def how_many_times(): x, y = 0, 1 c = 0 while x != y: c = c + 1 x, y = roll() return c, (x, y) Since I haven't seen it used in answers yet, here's another option using our new walrus operator def how_many_times(): roll_count = 1 while (rolls := roll())[0] != rol

Select columns based on dates - Pandas

2021-09-02 Thread Richard Medina
Hello, forum, I have a data frame with covid-19 cases per month from 2019 - 2021 like a header like this: Country, 01/01/2019, 2/01/2019, 01/02/2019, 3/01/2019, ... 01/01/2021, 2/01/2021, 01/02/2021, 3/01/2021 I want to filter my data frame for columns of a specific month range of march to Sep

Re: Request for argmax(list) and argmin(list)

2021-09-02 Thread Dan Stromberg
How about this?: python3 -c 'list_ = [1, 3, 5, 4, 2]; am = max((value, index) for index, value in enumerate(list_)); print(am)' On Wed, Sep 1, 2021 at 6:51 AM ABCCDE921 wrote: > Because that does 2 passes over the entire array when you only need one > and there is no option to specify if you w

Re: on floating-point numbers

2021-09-02 Thread Dennis Lee Bieber
On Fri, 3 Sep 2021 04:43:02 +1000, Chris Angelico declaimed the following: > >The naive summation algorithm used by sum() is compatible with a >variety of different data types - even lists, although it's documented >as being intended for numbers - but if you know for sure that you're >working wit

Re: on floating-point numbers

2021-09-02 Thread Dennis Lee Bieber
On Thu, 02 Sep 2021 12:08:21 -0300, Hope Rouselle declaimed the following: >Suppose these numbers are prices in dollar, never going beyond cents. >Would it be safe to multiply each one of them by 100 and therefore work >with cents only? For instance > A lot of software with a "monetary

Re: on floating-point numbers

2021-09-02 Thread Dennis Lee Bieber
On Thu, 02 Sep 2021 10:51:03 -0300, Hope Rouselle declaimed the following: ls = [7.23, 8.41, 6.15, 2.31, 7.73, 7.77] sum(ls) >39.594 > ls = [8.41, 6.15, 2.31, 7.73, 7.77, 7.23] sum(ls) >39.61 > >All I did was to take the first number, 7.23, and move it

Re: on floating-point numbers

2021-09-02 Thread Grant Edwards
On 2021-09-02, Hope Rouselle wrote: > Suppose these numbers are prices in dollar, never going beyond cents. > Would it be safe to multiply each one of them by 100 and therefore work > with cents only? The _practical_ answer is that no, it's not safe to use floating point when doing normal bookee

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 02/09/2021 20:11, MRAB wrote: >> In one of them (I can't recall which is which) they change on the 4th >> weekend of October/March in the other they change on the last weekend. >> >> > In the EU (and UK) it's the last Sunday in March/October. > > In the US it's second Sunday in March and the f

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:40 AM Alan Gauld via Python-list wrote: > > On 31/08/2021 23:31, Chris Angelico wrote: > > > Ah, good to know. I think that actually makes a lot of sense; in the > > US, they try to let everyone pretend that the rest of the world > > doesn't exist ("we always change at 2AM

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 02/09/2021 19:28, Chris Angelico wrote: >> Except for the places that don't follow the IANA scheme and/or >> dynamically change their time settings on a whim. To be complete >> you need the ability to manually override too. >> > > What places are those? Mainly small non-tech oriented places

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:26 AM Alan Gauld via Python-list wrote: > > On 31/08/2021 22:32, Chris Angelico wrote: > > > If we could abolish DST world-wide, life would be far easier. All the > > rest of it would be easy enough to handle. > We tried that in the UK for 2 years back in the '70s and very

Re: on floating-point numbers

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:58 AM Hope Rouselle wrote: > > Hope Rouselle writes: > > > Just sharing a case of floating-point numbers. Nothing needed to be > > solved or to be figured out. Just bringing up conversation. > > > > (*) An introduction to me > > > > I don't understand floating-point num

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread MRAB
On 2021-09-02 08:40, Alan Gauld via Python-list wrote: On 31/08/2021 23:31, Chris Angelico wrote: Ah, good to know. I think that actually makes a lot of sense; in the US, they try to let everyone pretend that the rest of the world doesn't exist ("we always change at 2AM"), but in Europe, they t

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:51 AM Hope Rouselle wrote: > > Chris Angelico writes: > > > On Mon, Aug 30, 2021 at 11:13 PM David Raymond > > wrote: > >> > >> > def how_many_times(): > >> > x, y = 0, 1 > >> > c = 0 > >> > while x != y: > >> > c = c + 1 > >> > x, y = roll() > >> > retu

Re: on floating-point numbers

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:29 AM Hope Rouselle wrote: > > Just sharing a case of floating-point numbers. Nothing needed to be > solved or to be figured out. Just bringing up conversation. > > (*) An introduction to me > > I don't understand floating-point numbers from the inside out, but I do > kn

Add a method to list the current named logging levels

2021-09-02 Thread Edward Spencer
Sometimes I like to pass the logging level up to the command line params so my user can specific what level of logging they want. However there is no easy method for pulling the named logging level names. Looking into the code, it would actually be incredibly easy to implement; in `logging.__in

Re: ANN: Dogelog Runtime, Prolog to the Moon (2021)

2021-09-02 Thread Mostowski Collapse
More best kept secrets of Prolog: Pattern Matching Everybody loves pattern matching. Languages like Python, release 3.10, even provide it now. There is now a match/case statement in Python. But Prolog users will scratch their head. Will my if-then-else be as fast as a imperative switch jump tabl

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:33 AM Hope Rouselle wrote: > Yeah. Here's a little context. I came across this by processing a list > of exercises. (I'm teaching a course --- you know that by now, I > guess.) So the first thing I observed was the equal volume of work > dedicated to while loops and fo

Re: on floating-point numbers

2021-09-02 Thread Hope Rouselle
Hope Rouselle writes: > Just sharing a case of floating-point numbers. Nothing needed to be > solved or to be figured out. Just bringing up conversation. > > (*) An introduction to me > > I don't understand floating-point numbers from the inside out, but I do > know how to work with base 2 and

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:22 AM Alan Gauld via Python-list wrote: > > On 31/08/2021 22:13, Chris Angelico wrote: > > > But ultimately, it all just means that timezones are too hard for > > humans to handle, and we MUST handle them using IANA's database. It is > > the only way. > > Except for the pl

Re: on floating-point numbers

2021-09-02 Thread Christian Gollwitzer
Am 02.09.21 um 15:51 schrieb Hope Rouselle: Just sharing a case of floating-point numbers. Nothing needed to be solved or to be figured out. Just bringing up conversation. (*) An introduction to me I don't understand floating-point numbers from the inside out, but I do know how to work with b

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Chris Angelico
On Fri, Sep 3, 2021 at 4:18 AM Dennis Lee Bieber wrote: > > On Tue, 31 Aug 2021 16:53:14 -0500, 2qdxy4rzwzuui...@potatochowder.com > declaimed the following: > > >On 2021-09-01 at 07:32:43 +1000, > >Chris Angelico wrote: > >> If we could abolish DST world-wide, life would be far easier. All the >

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Hope Rouselle
Chris Angelico writes: > On Mon, Aug 30, 2021 at 11:13 PM David Raymond > wrote: >> >> > def how_many_times(): >> > x, y = 0, 1 >> > c = 0 >> > while x != y: >> > c = c + 1 >> > x, y = roll() >> > return c, (x, y) >> >> Since I haven't seen it used in answers yet, here's another

Re: on the popularity of loops while and for

2021-09-02 Thread Hope Rouselle
Terry Reedy writes: > On 8/28/2021 9:31 AM, Hope Rouselle wrote: >> I'd like get a statistic of how often each loop is used in practice. > > My guess is that for loops are at least twice as common as while loops. Scanning just the Python 3.9.6's Lib/ directory --- using the ast module and the pr

Re: urgent

2021-09-02 Thread Michael F. Stemper
On 31/08/2021 18.02, Barry wrote: The big problem with >>> is that it means a third level quote in email clients. So when people cut-n-paste REPL output it’s formatted badly by email clients. A prompt that avoided that issue would be nice. A little bit of piping fixes that: username@hostname$

Re: on the popularity of loops while and for

2021-09-02 Thread Hope Rouselle
Chris Angelico writes: > On Sun, Aug 29, 2021 at 7:40 AM Hope Rouselle wrote: >> >> I'd like get a statistic of how often each loop is used in practice. >> >> I was trying to take a look at the Python's standard libraries --- those >> included in a standard installation of Python 3.9.6, say ---

Re: on floating-point numbers

2021-09-02 Thread Christian Gollwitzer
Am 02.09.21 um 16:49 schrieb Julio Di Egidio: On Thursday, 2 September 2021 at 16:41:38 UTC+2, Peter Pearson wrote: On Thu, 02 Sep 2021 10:51:03 -0300, Hope Rouselle wrote: 39.61 Welcome to the exciting world of roundoff error: Welcome to the exiting world of Usenet. *Plonk*

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 23:31, Chris Angelico wrote: > Ah, good to know. I think that actually makes a lot of sense; in the > US, they try to let everyone pretend that the rest of the world > doesn't exist ("we always change at 2AM"), but in Europe, they try to > synchronize for the convenience of commerce

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Hope Rouselle
David Raymond writes: >> def how_many_times(): >> x, y = 0, 1 >> c = 0 >> while x != y: >> c = c + 1 >> x, y = roll() >> return c, (x, y) > > Since I haven't seen it used in answers yet, here's another option using our > new walrus operator > > def how_many_times(): > roll_co

Re: Mutually exclusive options with argparse.

2021-09-02 Thread hongy...@gmail.com
On Thursday, September 2, 2021 at 10:16:09 AM UTC+8, hongy...@gmail.com wrote: > On Wednesday, September 1, 2021 at 11:20:21 PM UTC+8, Lee Congdon wrote: > > Does a mutually exclusive group, as described in "Mutual exclusion" at > > https://docs.python.org/3/library/argparse.html meet your needs?

Re: on floating-point numbers

2021-09-02 Thread Peter Pearson
On Thu, 02 Sep 2021 10:51:03 -0300, Hope Rouselle wrote: > import sys sys.version > '3.8.10 (tags/... > ls = [7.23, 8.41, 6.15, 2.31, 7.73, 7.77] sum(ls) > 39.594 > ls = [8.41, 6.15, 2.31, 7.73, 7.77, 7.23] sum(ls) > 39.61 Welcome to the excit

Re: Mutually exclusive options with argparse.

2021-09-02 Thread hongy...@gmail.com
On Wednesday, September 1, 2021 at 11:20:21 PM UTC+8, Lee Congdon wrote: > Does a mutually exclusive group, as described in "Mutual exclusion" at > https://docs.python.org/3/library/argparse.html meet your needs? Thanks for letting me know about this feature. I'll give it a try. > > On Wed, Se

Re: on writing a while loop for rolling two dice

2021-09-02 Thread Hope Rouselle
dn writes: > On 29/08/2021 08.46, Hope Rouselle wrote: >> Here's my solution: >> >> --8<---cut here---start->8--- >> def how_many_times(): >> x, y = 0, 1 >> c = 0 >> while x != y: >> c = c + 1 >> x, y = roll() >> return c, (x, y) > >> >> Why a

on floating-point numbers

2021-09-02 Thread Hope Rouselle
Just sharing a case of floating-point numbers. Nothing needed to be solved or to be figured out. Just bringing up conversation. (*) An introduction to me I don't understand floating-point numbers from the inside out, but I do know how to work with base 2 and scientific notation. So the idea of

( AI retail store inventory control.)

2021-09-02 Thread Alex Kaye
Looking for Python package to develop positive inventory control for a chain of stores. Alex kaye -- https://mail.python.org/mailman/listinfo/python-list

Re: on the popularity of loops while and for

2021-09-02 Thread Hope Rouselle
Barry writes: >> On 28 Aug 2021, at 22:42, Hope Rouselle wrote: >> >> I'd like get a statistic of how often each loop is used in practice. >> >> I was trying to take a look at the Python's standard libraries --- those >> included in a standard installation of Python 3.9.6, say --- to see >>

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 22:32, Chris Angelico wrote: > If we could abolish DST world-wide, life would be far easier. All the > rest of it would be easy enough to handle. We tried that in the UK for 2 years back in the '70s and very quickly reverted to DST when they realized that the number of fatalities amo

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Alan Gauld via Python-list
On 31/08/2021 22:13, Chris Angelico wrote: > But ultimately, it all just means that timezones are too hard for > humans to handle, and we MUST handle them using IANA's database. It is > the only way. Except for the places that don't follow the IANA scheme and/or dynamically change their time sett

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Dennis Lee Bieber
On Tue, 31 Aug 2021 16:53:14 -0500, 2qdxy4rzwzuui...@potatochowder.com declaimed the following: >On 2021-09-01 at 07:32:43 +1000, >Chris Angelico wrote: >> If we could abolish DST world-wide, life would be far easier. All the >> rest of it would be easy enough to handle. > >Agreed. > Unf

Re: Trouble propagating logging configuration

2021-09-02 Thread Loris Bennett
"Dieter Maurer" writes: > Loris Bennett wrote at 2021-9-1 13:48 +0200: >> ... >>Yes, but to quote from >>https://docs.python.org/3.6/howto/logging.html#logging-basic-tutorial: >> >> A good convention to use when naming loggers is to use a module-level >> logger, in each module which uses loggi

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Dennis Lee Bieber
On Wed, 1 Sep 2021 09:38:30 +1000, Chris Angelico declaimed the following: >Yeah, I have no idea where the "farmers" explanation came from. >Growing up, we had some friends in countrified areas, including a >sheep farmer who showed us a ton of stuff about how shearing worked, >how moronic sheep

Re: The sqlite3 timestamp conversion between unixepoch and localtime can't be done according to the timezone setting on the machine automatically.

2021-09-02 Thread Dennis Lee Bieber
On Wed, 1 Sep 2021 11:19:03 +1200, dn via Python-list declaimed the following: >time-zones. (Yes, you did say "CA", but easily 'missed' - by author and >reader alike) Or possibly misread as the Peoples Republic of CALIFORNIA (even if there isn't a "New Brunswick" in the PRCa)