Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread Thomas Passin via Python-list
you want a Pandas-specific approach?  Many people would >     rather >     keep code independent of special libraries if possible; > >     2. How big can these collections of target cells be, roughly speaking? >     The size could make a big difference in

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread marc nicole via Python-list
target cell. > > > > > > the surrounding cells to consider for a specific target cell are > > : (x-1,y), > > > (x,y-1),(x+1,y);(x,y+1), specifically I randomly choose 1 to 4 > > cells from > > > these and consider for repl

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread Thomas Passin via Python-list
hould work on formatting code for this list.  Your code below is very complex and would take a lot of work to reformat to the point where it is readable, especially with the nearly impenetrable arguments in some places.  Probably all that is needed is to replace all tabs by (s

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread marc nicole via Python-list
very complex and would take a lot of work to reformat to the > point where it is readable, especially with the nearly impenetrable > arguments in some places. Probably all that is needed is to replace all > tabs by (say) three spaces, and to make sure

Re: How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread Thomas Passin via Python-list
that is needed is to replace all tabs by (say) three spaces, and to make sure you intentionally break lines well before they might get word-wrapped. Here is one example I have reformatted (I hope I got this right): list_tuples_idx_cells_all_datasets = list(filter( lambda x

How to replace a cell value with each of its contour cells and yield the corresponding datasets seperately in a list according to a Pandas-way?

2024-01-21 Thread marc nicole via Python-list
Hello, I have an initial dataframe with a random list of target cells (each cell being identified with a couple (x,y)). I want to yield four different dataframes each containing the value of one of the contour (surrounding) cells of each specified target cell. the surrounding cells to consider fo

Re: set.add() doesn't replace equal element

2022-12-31 Thread Ian Pilcher
On 12/30/22 17:00, Paul Bryan wrote: It seems to me like you have to ideas of what "equal" means. You want to update a "non-equal/equal" value in the set (because of a different time stamp). If you truly considered them equal, the time stamp would be irrelevant and updating the value in the set

Re: set.add() doesn't replace equal element

2022-12-30 Thread Paul Bryan
It seems to me like you have to ideas of what "equal" means. You want to update a "non-equal/equal" value in the set (because of a different time stamp). If you truly considered them equal, the time stamp would be irrelevant and updating the value in the set would be unnecessary. I would: a)

Re: set.add() doesn't replace equal element

2022-12-30 Thread Chris Angelico
On Sat, 31 Dec 2022 at 09:29, Ian Pilcher wrote: > > On 12/30/22 15:47, Paul Bryan wrote: > > What kind of elements are being added to the set? Can you show > > reproducible sample code? > > The objects in question are DHCP leases. I consider them "equal" if > the lease address (or IPv6 prefix) i

Re: set.add() doesn't replace equal element

2022-12-30 Thread Ian Pilcher
On 12/30/22 15:47, Paul Bryan wrote: What kind of elements are being added to the set? Can you show reproducible sample code? The objects in question are DHCP leases. I consider them "equal" if the lease address (or IPv6 prefix) is equal, even if the timestamps have changed. That code is not

RE: set.add() doesn't replace equal element

2022-12-30 Thread avi.e.gross
in use, and replacing it with the latest if needed. Avi -Original Message- From: Python-list On Behalf Of Ian Pilcher Sent: Friday, December 30, 2022 4:41 PM To: python-list@python.org Subject: set.add() doesn't replace equal element I just discovered this behavior, which is proble

Re: set.add() doesn't replace equal element

2022-12-30 Thread Chris Angelico
On Sat, 31 Dec 2022 at 08:42, Ian Pilcher wrote: > > I just discovered this behavior, which is problematic for my particular > use. Is there a different set API (or operator) that can be used to > add an element to a set, and replace any equal element? > > If not, am I correct

Re: set.add() doesn't replace equal element

2022-12-30 Thread Paul Bryan
add an element to a set, and replace any equal element? If not, am I correct that I should call set.discard() before calling set.add() to achieve the behavior that I want? -- Google Where

set.add() doesn't replace equal element

2022-12-30 Thread Ian Pilcher
I just discovered this behavior, which is problematic for my particular use. Is there a different set API (or operator) that can be used to add an element to a set, and replace any equal element? If not, am I correct that I should call set.discard() before calling set.add() to achieve the

Re: How to replace an instance method?

2022-09-21 Thread Diego Souza
no hyperlink attribute. There is no option to make it load the links. To force it to be loaded, we need to replace load_workbook as well. This method asks openpyxl to load the workbook, deciding whether it will discard the links or not. The second problem is that as soon as you instantiate an

Re: How to replace an instance method?

2022-09-19 Thread Eryk Sun
On 9/19/22, 2qdxy4rzwzuui...@potatochowder.com <2qdxy4rzwzuui...@potatochowder.com> wrote: > On 2022-09-18 at 09:11:28 +, > Stefan Ram wrote: > >> r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): >> >types.MethodType( function, instance ) >> >functools.partial( function, instance ) >

Re: How to replace an instance method?

2022-09-19 Thread 2QdxY4RzWzUUiLuE
On 2022-09-18 at 09:11:28 +, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): > >types.MethodType( function, instance ) > >functools.partial( function, instance ) > >new_method.__get__( instance ) > > I wonder which of these three possibilities expresses > t

Re: How to replace an instance method?

2022-09-19 Thread Eryk Sun
On 9/18/22, Stefan Ram wrote: > r...@zedat.fu-berlin.de (Stefan Ram) writes (abbreviated): >>types.MethodType( function, instance ) >>functools.partial( function, instance ) >>new_method.__get__( instance ) > > I wonder which of these three possibilities expresses > the idea of creating a new

Re: How to replace an instance method?

2022-09-19 Thread Weatherby,Gerard
m 17.09.2022 um 00:35 schrieb Dan Stromberg: On Fri, Sep 16, 2022 at 2:06 PM Ralf M. mailto:ral...@t-online.de>> wrote: I would like to replace a method of an instance, but don't know how to do it properly. You appear to have a good answer, but... are you sure this is a good idea? It&#

Re: How to replace an instance method?

2022-09-18 Thread Lars Liedtke
change the old method to call the new method but with the parameters the new method expects. If you explain this in the docstrings as well. Then you do not need to actually replace the method. Or you had a completely different use-case in mind, that I missed. Cheers Lars Lars Liedtke Software

Re: How to replace an instance method?

2022-09-17 Thread Eryk Sun
On 9/17/22, Chris Angelico wrote: > > A method IS a function. A bound method is a function with one argument > locked in, but still a function. We were talking past each other. A method object is not a function object. You're talking about a function defined in a class that's accessed as a method

Re: How to replace an instance method?

2022-09-17 Thread Chris Angelico
On Sun, 18 Sept 2022 at 10:29, wrote: > > > From your description, Chris, it sounds like the functional programming > technique often called currying. A factory function is created where one (or > more) parameters are sort of frozen in so the user never sees or cares about > them, and a modified o

RE: How to replace an instance method?

2022-09-17 Thread avi.e.gross
ase, the function now knows what object it is attached to as this. -Original Message- From: Python-list On Behalf Of Chris Angelico Sent: Saturday, September 17, 2022 8:21 PM To: python-list@python.org Subject: Re: How to replace an instance method? On Sun, 18 Sept 2022 at 09:37, Eryk

Re: How to replace an instance method?

2022-09-17 Thread Chris Angelico
On Sun, 18 Sept 2022 at 09:37, Eryk Sun wrote: > > On 9/17/22, Chris Angelico wrote: > > > > The two are basically equivalent. Using functools.partial emphasizes > > the fact that all you're doing is "locking in" the first parameter; > > using the __get__ method emphasizes the fact that functions

Re: How to replace an instance method?

2022-09-17 Thread Eryk Sun
On 9/17/22, Chris Angelico wrote: > > The two are basically equivalent. Using functools.partial emphasizes > the fact that all you're doing is "locking in" the first parameter; > using the __get__ method emphasizes the fact that functions are, > fundamentally, the same thing as methods. Choose whi

Re: How to replace an instance method?

2022-09-17 Thread Chris Angelico
On Sun, 18 Sept 2022 at 07:20, Ralf M. wrote: > > Am 16.09.2022 um 23:34 schrieb Eryk Sun: > > On 9/16/22, Ralf M. wrote: > >> I would like to replace a method of an instance, but don't know how to > >> do it properly. > > > > A function is a descr

Re: How to replace an instance method?

2022-09-17 Thread Ralf M.
Am 17.09.2022 um 00:35 schrieb Dan Stromberg: On Fri, Sep 16, 2022 at 2:06 PM Ralf M. <mailto:ral...@t-online.de>> wrote: I would like to replace a method of an instance, but don't know how to do it properly. You appear to have a good answer, but...  are you sure

Re: How to replace an instance method?

2022-09-17 Thread Ralf M.
Am 16.09.2022 um 23:34 schrieb Eryk Sun: On 9/16/22, Ralf M. wrote: I would like to replace a method of an instance, but don't know how to do it properly. A function is a descriptor that binds to any object as a method. For example: >>> f = lambda self, x: self + x

Re: How to replace an instance method?

2022-09-16 Thread Thomas Passin
2:06 PM Ralf M. wrote: I would like to replace a method of an instance, but don't know how to do it properly. You appear to have a good answer, but... are you sure this is a good idea? It'll probably be confusing to future maintainers of this code, and I doubt static analyze

Re: How to replace an instance method?

2022-09-16 Thread Dan Stromberg
On Fri, Sep 16, 2022 at 2:06 PM Ralf M. wrote: > I would like to replace a method of an instance, but don't know how to > do it properly. > You appear to have a good answer, but... are you sure this is a good idea? It'll probably be confusing to future maintainers of thi

Re: How to replace an instance method?

2022-09-16 Thread Eryk Sun
On 9/16/22, Ralf M. wrote: > I would like to replace a method of an instance, but don't know how to > do it properly. A function is a descriptor that binds to any object as a method. For example: >>> f = lambda self, x: self + x >>> o = 42 >&g

Re: How to replace an instance method?

2022-09-16 Thread Chris Angelico
On Sat, 17 Sept 2022 at 07:07, Ralf M. wrote: > > I would like to replace a method of an instance, but don't know how to > do it properly. > > My first naive idea was > > inst = SomeClass() > def new_method(self, param): > # do something > return

How to replace an instance method?

2022-09-16 Thread Ralf M.
I would like to replace a method of an instance, but don't know how to do it properly. My first naive idea was inst = SomeClass() def new_method(self, param): # do something return whatever inst.method = new_method however that doesn't work: self isn't passed as first p

Re: Suggestion. Replace Any with *

2022-06-13 Thread Chris Angelico
On Tue, 14 Jun 2022 at 01:59, h3ck phy wrote: > > It would be nice if we could write something like this > data: dict[str, *] = {} > instead of > data: dict[str, Any] = {} > > In import statement asterisk means "all names" in a module. > But in type closure it should mean "all types". Type hints

Suggestion. Replace Any with *

2022-06-13 Thread h3ck phy
It would be nice if we could write something like this data: dict[str, *] = {} instead of data: dict[str, Any] = {} In import statement asterisk means "all names" in a module. But in type closure it should mean "all types". -- https://mail.python.org/mailman/listinfo/python-list

Re: How to replace characters in a string?

2022-06-08 Thread Greg Ewing
On 9/06/22 5:55 am, Dennis Lee Bieber wrote: There are no mutable strings in Python. If you really want a mutable sequence of characters, you can use array.array, but you won't be able to use it directly in place of a string in most contexts. -- Greg -- https://mail.python.org/mailma

Re: How to replace characters in a string?

2022-06-08 Thread Greg Ewing
On 8/06/22 10:26 pm, Jon Ribbens wrote: Here's a head-start on some characters you might want to translate, Another possibility that might make sense in this case is to simply strip out all punctuation before comparing. That would take care of things being spelled with or without hyphens, comma

Re: How to replace characters in a string?

2022-06-08 Thread Dennis Lee Bieber
On Wed, 8 Jun 2022 11:09:05 +0200, Dave declaimed the following: >Hi, > >Thanks for this! > >So, is there a copy function/method that returns a MutableString like in >objective-C? I’ve solved this problems before in a number of languages like >Objective-C and AppleScript. There are no

Re: How to replace characters in a string?

2022-06-08 Thread Barry Scott
out keeping your shoes dark with >> "black polish" so I keep repeating it is very hard or frankly impossible, to >> catch every case I can imagine and the many I can't! >> >> But the emphasis here is not your overall problem. It is about whether and >>

Re: How to replace characters in a string?

2022-06-08 Thread Dave
t your overall problem. It is about whether and > how the computer language called python, and perhaps some add-on modules, can > be used to solve each smaller need such as recognizing a pattern or replacing > text. It can do quite a bit but only when the specification of the problem is &

Re: How to replace characters in a string?

2022-06-08 Thread Avi Gross via Python-list
ther and how  the computer language called python, and perhaps some add-on modules, can be  used to solve each smaller need such as recognizing a pattern or replacing text. It can do quite a bit but only when the specification of the problem is exact.  -Original Message- From: Dave To: py

Re: How to replace characters in a string?

2022-06-08 Thread Jon Ribbens via Python-list
On 2022-06-08, Dave wrote: > I misunderstood how it worked, basically I’ve added this function: > > def filterCommonCharacters(theString): > myNewString = theString.replace("\u2019", "'") > return myNewString > Which returns a new string replacing the common characters. > > This can easil

Re: How to replace characters in a string?

2022-06-08 Thread Dave
> On 8 Jun 2022, at 11:25, Dave wrote: > >myNewString = theString.replace("\u2014", “]” #just an example Opps! Make that myNewString = myNewString.replace("\u2014", “]” #just an example -- https://mail.python.org/mailman/listinfo/python-list

Re: How to replace characters in a string?

2022-06-08 Thread De ongekruisigde
On 2022-06-08, Dave wrote: > Hi All, > > I decided to start a new thread as this really is a new subject. > > I've got two that appear to be identical, but fail to compare. After getting > the ascii encoding I see that they are indeed different, my question is how >

Re: How to replace characters in a string?

2022-06-08 Thread Dan Stromberg
On Wed, Jun 8, 2022 at 1:11 AM Dave wrote: > I've got two that appear to be identical, but fail to compare. After > getting the ascii encoding I see that they are indeed different, my > question is how can I replace the \u2019m with a regular single quote mark > (or apostrophe

Re: How to replace characters in a string?

2022-06-08 Thread Roel Schroeven
mon characters. This can easily be extended to include other characters as and when they come up by adding a line as so: myNewString = theString.replace("\u2014", “]” #just an example Which is what I was trying to achieve. When you have multiple replacements to do, there's an

Re: How to replace characters in a string?

2022-06-08 Thread Dave
Hi, I misunderstood how it worked, basically I’ve added this function: def filterCommonCharacters(theString): myNewString = theString.replace("\u2019", "'") return myNewString Which returns a new string replacing the common characters. This can easily be extended to include other chara

Re: How to replace characters in a string?

2022-06-08 Thread Joel Goldstick
o me that you failed to realize that string methods return results. They don't change the string in place: Python 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>&

Re: How to replace characters in a string?

2022-06-08 Thread Karsten Hilbert
Am Wed, Jun 08, 2022 at 11:09:05AM +0200 schrieb Dave: > myString = 'Hello' > myNewstring = myString.replace(myString,'e','a’) That won't work (last quote) but apart from that: myNewstring = myString.replace('e', 'a') Karsten -- GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B -- https:

Re: How to replace characters in a string?

2022-06-08 Thread Chris Angelico
On Wed, 8 Jun 2022 at 19:13, Dave wrote: > > Hi, > > Thanks for this! > > So, is there a copy function/method that returns a MutableString like in > objective-C? I’ve solved this problems before in a number of languages like > Objective-C and AppleScript. > > Basically there is a set of common c

Re: How to replace characters in a string?

2022-06-08 Thread Dave
r: 'str' object cannot be interpreted as an integer I can’t see of a way to do this in Python? All the Best Dave > On 8 Jun 2022, at 10:14, Chris Angelico wrote: > > On Wed, 8 Jun 2022 at 18:12, Dave wrote: > >> I tried the but it doesn’t seem to work? >> myCompareF

Re: How to replace characters in a string?

2022-06-08 Thread Chris Angelico
On Wed, 8 Jun 2022 at 18:20, Dave wrote: > > PS > > I’ve also tried: > myCompareFile1 = myTitleName > myCompareFile1.replace("\u2019", "'") > myCompareFile2 = myCompareFileName > myCompareFile2.replace("\u2019", "'")

Re: How to replace characters in a string?

2022-06-08 Thread Dave
PS I’ve also tried: myCompareFile1 = myTitleName myCompareFile1.replace("\u2019", "'") myCompareFile2 = myCompareFileName myCompareFile2.replace("\u2019", "'") Which also doesn’t work, the replace itself work but it still fails the compare? &

Re: How to replace characters in a string?

2022-06-08 Thread Chris Angelico
On Wed, 8 Jun 2022 at 18:12, Dave wrote: > I tried the but it doesn’t seem to work? > myCompareFile1 = ascii(myTitleName) > myCompareFile1.replace("\u2019", "'") Strings in Python are immutable. When you call ascii(), you get back a new string, but it's o

How to replace characters in a string?

2022-06-08 Thread Dave
Hi All, I decided to start a new thread as this really is a new subject. I've got two that appear to be identical, but fail to compare. After getting the ascii encoding I see that they are indeed different, my question is how can I replace the \u2019m with a regular single quote mar

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Michio Suginoo
t;> have you tried looping through the dictionary and changing each possible >> character? >> >> >> On Wed, Aug 5, 2020 at 5:12 PM Michio Suginoo >> wrote: >> >>> Hi MRAB, >>> >>> Sorry, I simply do not understand the intention of your st

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Michio Suginoo
Sorry, I simply do not understand the intention of your statement. >> If .replace() does not do what I want to do: to replace all ' í ' with >> 'i' >> in any form . >> Could you advise me other means to do it? >> >> I am still a learner, so I am

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Bob van der Poel
Hi MRAB, > > Sorry, I simply do not understand the intention of your statement. > If .replace() does not do what I want to do: to replace all ' í ' with 'i' > in any form . > Could you advise me other means to do it? > > I am still a learner, so I am not knowle

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Michio Suginoo
Name' : correction_dic2}) This case, unlike the earlier case, is aiming at replacing entire strings. Thanks, Best On Wed, Aug 5, 2020 at 9:12 PM Michio Suginoo wrote: > Hi MRAB, > > Sorry, I simply do not understand the intention of your statement. > If .replace() does not do what

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Michio Suginoo
Hi MRAB, Sorry, I simply do not understand the intention of your statement. If .replace() does not do what I want to do: to replace all ' í ' with 'i' in any form . Could you advise me other means to do it? I am still a learner, so I am not knowledgeable. But, I presume, th

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread MRAB
On 2020-08-06 00:06, Michio Suginoo wrote: Hi MRAB, Here is an example: In the original dataframe, I have something like, 'Agronomía'. And I try to transform it to 'Agronomia'. In this case, I try to replace í with i: the former with a Spanish accent, the latter withou

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Michio Suginoo
Hi MRAB, Here is an example: In the original dataframe, I have something like, 'Agronomía'. And I try to transform it to 'Agronomia'. In this case, I try to replace í with i: the former with a Spanish accent, the latter without. Thanks Best On Wed, Aug 5, 2020 at 8:00 PM MRA

Re: .replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread MRAB
On 2020-08-05 23:21, Michio Suginoo wrote: Hi, I have trouble with .replace() method in a Pandas DataFrame. My code is something like this: correction_dic1 = {'á': 'a', 'í': 'i', 'ú': 'u', 'ó': 'o'} df = df.replace(

.replace() to replace elements in a Pandas DataFrame

2020-08-05 Thread Michio Suginoo
Hi, I have trouble with .replace() method in a Pandas DataFrame. My code is something like this: correction_dic1 = {'á': 'a', 'í': 'i', 'ú': 'u', 'ó': 'o'} df = df.replace({'Name' : correction_dic1}) Basica

Re: Vim settings for Python (was: tab replace to space 4)

2019-12-08 Thread Peter J. Holzer
On 2019-12-07 11:59:31 -0800, Bill Campbell wrote: > On Sat, Dec 07, 2019, Peter J. Holzer wrote: > >As an aside, to prevent vim from inserting tabs in the first place, set > >expandtab > >sw=4 > >and maybe also > >ts=4 > > Inserting a comment in the file like this makes thing easy. >

Re: Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Bill Campbell
On Sat, Dec 07, 2019, Peter J. Holzer wrote: >As an aside, to prevent vim from inserting tabs in the first place, set >expandtab >sw=4 >and maybe also >ts=4 Inserting a comment in the file like this makes thing easy. # vim: expandtab sw=4 ts=4 nows wm=0 Bill -- INTERNET: b...@cel

Re: Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Bev In TX
> On Dec 7, 2019, at 4:16 AM, Peter J. Holzer wrote: > > As an aside, to prevent vim from inserting tabs in the first place, set >expandtab >sw=4 > and maybe also >ts=4 > (The latter is very much a matter of taste. I don't unless I have to > edit code which already contains tabs inte

Vim settings for Python (was: tab replace to space 4)

2019-12-07 Thread Peter J. Holzer
On 2019-11-29 13:46:38 +0900, 황병희 wrote: > usally i write python code in gnu emacs on ubuntu 18.04 sometimes i > re-edit the code vim in same machine so often when i do run the code in > shell like as ./test.py i meet consol error -- which line wrong! > > so i am considering how ca

Re: tab replace to space 4

2019-12-02 Thread 황병희
Hi, Gilmeh^^^ > We are Python people, aren't we? Looks good, i did copy it [1], and thanks^^^ [1] https://gitlab.com/soyeomul/test/blob/master/untabify.py Sincerely, -- ^고맙습니다 _地平天成_ 감사합니다_^))// -- https://mail.python.org/mailman/listinfo/python-list

Re: tab replace to space 4 (rmlibre)

2019-12-01 Thread rmlibre
> Its just that I've just began to touch tkinter, and would like to know of > bug-related pitfalls before I waste energy on trying to figure out what I > did wrong. :-\ One thing which is not obvious or easy to debug: Text widgets have some kind of inefficiency related to really long lines that d

Re: tab replace to space 4

2019-11-29 Thread R.Wieser
Terry, > I have been using tk/tkinter based IDLE for over a decade on Windows with > very few issues. I think they are similarly stable on linux, etc. [Snip] Thanks for that explanation. And I see that, in my question, I should have asked for the involved OS too. Regards, Rudy Wieser -- ht

Re: tab replace to space 4

2019-11-29 Thread Terry Reedy
On 11/29/2019 3:05 PM, R.Wieser wrote: Terry, Its just that I've just began to touch tkinter, and would like to know of bug-related pitfalls before I waste energy on trying to figure out what I did wrong. :-\ I have been using tk/tkinter based IDLE for over a decade on Windows with very few

Re: tab replace to space 4

2019-11-29 Thread R.Wieser
Terry, > R.W., are you reading via c.l.p, or the python google group? The first, using nntp.aioe.org > Don't hold your breath. A similar poster I challenged on StackOverflow > was honest enough to admit that he had not touched IDLE for a decade. Its just that I've just began to touch tkinter,

Re: tab replace to space 4

2019-11-29 Thread Terry Reedy
On 11/29/2019 4:34 AM, R.Wieser wrote: Moi, tkinter/IDLE in py380 : completely buggy. That troll post is not in the python-list archive (whereas RW's response is), so it is likely from someone banned on the list itself. R.W., are you reading via c.l.p, or the python google group? Exampl

Re: tab replace to space 4

2019-11-29 Thread 황병희
Hello, Pankaj^^^ > In Emacs, use "M-x untabify". [...] Then i solved problem You nice guy! Sincerely, -- ^고맙습니다 _地平天成_ 감사합니다_^))// -- https://mail.python.org/mailman/listinfo/python-list

tab replace to space 4

2019-11-29 Thread 황병희
[i am writing question on comp.lang.python] usally i write python code in gnu emacs on ubuntu 18.04 sometimes i re-edit the code vim in same machine so often when i do run the code in shell like as ./test.py i meet consol error -- which line wrong! so i am considering how can i replace all tab

Re: tab replace to space 4

2019-11-29 Thread R.Wieser
Moi, > tkinter/IDLE in py380 : completely buggy. Example code please ? (plus a description of what should happen and what happens instead if you have it) Regards, Rudy Wieser -- https://mail.python.org/mailman/listinfo/python-list

Re: tab replace to space 4

2019-11-29 Thread Terry Reedy
replace all tab to space 4 within python code. if there is solution in google i am very sorry. In Emacs, use "M-x untabify". And "M-x tabify" if you want to do the reverse. IDLE has entries on the Format menu to do the same. -- Terry Jan Reedy -- https://mail.python.org/mai

Re: tab replace to space 4

2019-11-28 Thread Pankaj Jangid
황병희 writes: > usally i write python code in gnu emacs on ubuntu 18.04 sometimes i > re-edit the code vim in same machine so often when i do run the code in > shell like as ./test.py i meet consol error -- which line wrong! > > so i am considering how can i replace all tab to space

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-23 Thread Piet van Oostrum
Markos writes: [...] >>> Please, any comments or tip? >> data = pd.read_csv ('table.csv', sep = ',', skiprows = 1, decimal=b',', >> skipinitialspace=True) >> > Thank you for the tip. > > I didn't realize that I could avoid formatting problems in the dataframe > or array simply by using the read_

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Markos
Em 22-09-2019 13:10, Piet van Oostrum escreveu: Markos writes: Hi, I have a table.csv file with the following structure: , Polyarene conc ,, mg L-1 ,,, Spectrum, Py, Ace, Anth, 1, "0,456", "0,120", "0,168" 2, "0,456", "0,040", "0,280" 3, "0,152", "0,200", "0,280" I open as dataframe

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Richard Damon
On 9/22/19 7:05 PM, Markos wrote: > > Em 22-09-2019 13:10, Piet van Oostrum escreveu: >> Markos writes: >> >>> Hi, >>> >>> I have a table.csv file with the following structure: >>> >>> , Polyarene conc ,, mg L-1 ,,, >>> Spectrum, Py, Ace, Anth, >>> 1, "0,456", "0,120", "0,168" >>> 2, "0,456",

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Markos
Em 22-09-2019 13:10, Piet van Oostrum escreveu: Markos writes: Hi, I have a table.csv file with the following structure: , Polyarene conc ,, mg L-1 ,,, Spectrum, Py, Ace, Anth, 1, "0,456", "0,120", "0,168" 2, "0,456", "0,040", "0,280" 3, "0,152", "0,200", "0,280" I open as dataframe wi

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Piet van Oostrum
Markos writes: > Hi, > > I have a table.csv file with the following structure: > > , Polyarene conc ,, mg L-1 ,,, > Spectrum, Py, Ace, Anth, > 1, "0,456", "0,120", "0,168" > 2, "0,456", "0,040", "0,280" > 3, "0,152", "0,200", "0,280" > > I open as dataframe with the command: > > data = pd.rea

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Eryk Sun
On 9/22/19, Albert-Jan Roskam wrote: > > Do you think it's a deliberate design choice that decimal and thousands > where used here as params, and not a 'locale' param? It seems nice to be > able to specify e.g. locale='dutch' and then all the right lc_numeric, > lc_monetary, lc_time where used. Or

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Cameron Simpson
On 22Sep2019 07:39, Albert-Jan Roskam wrote: On 22 Sep 2019 04:27, Cameron Simpson wrote: On 21Sep2019 20:42, Markos wrote: I have a table.csv file with the following structure: , Polyarene conc ,, mg L-1 ,,, Spectrum, Py, Ace, Anth, 1, "0,456", "0,120", "0,168" 2, "0,456", "0,040", "0,2

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Albert-Jan Roskam
On 22 Sep 2019 04:27, Cameron Simpson wrote: On 21Sep2019 20:42, Markos wrote: >I have a table.csv file with the following structure: > >, Polyarene conc ,, mg L-1 ,,, >Spectrum, Py, Ace, Anth, >1, "0,456", "0,120", "0,168" >2, "0,456", "0,040", "0,280" >3, "0,152", "0,200", "0,280" > >I

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-21 Thread Cameron Simpson
On 21Sep2019 20:42, Markos wrote: I have a table.csv file with the following structure: , Polyarene conc ,, mg L-1 ,,, Spectrum, Py, Ace, Anth, 1, "0,456", "0,120", "0,168" 2, "0,456", "0,040", "0,280" 3, "0,152", "0,200", "0,280" I open as dataframe with the command: data = pd.read_csv ('

Re: Most efficient way to replace "," with "." in a array and/or dataframe

2019-09-21 Thread MRAB
2  3 0,152 0,200 0,280 I copy the numeric fields to an array with the command: data_array = data.values [:, 1:] And the data_array variable gets the fields in string format: [['0,456' '0,120' '0,168'] ['0,456' '0,040' '0,280

Most efficient way to replace "," with "." in a array and/or dataframe

2019-09-21 Thread Markos
opy the numeric fields to an array with the command: data_array = data.values [:, 1:] And the data_array variable gets the fields in string format: [['0,456' '0,120' '0,168'] ['0,456' '0,040' '0,280'] ['0,152' '0,200&

Re: How Do You Replace Variables With Their Values?

2019-07-14 Thread Chris Angelico
On Mon, Jul 15, 2019 at 5:45 AM Ian Kelly wrote: > > On Thu, Jul 11, 2019 at 11:10 PM Chris Angelico wrote: > > > > On Fri, Jul 12, 2019 at 2:30 PM Aldwin Pollefeyt > > wrote: > > > > > > Wow, I'm so sorry I answered on the question : "How

Re: How Do You Replace Variables With Their Values?

2019-07-14 Thread Ian Kelly
On Thu, Jul 11, 2019 at 11:10 PM Chris Angelico wrote: > > On Fri, Jul 12, 2019 at 2:30 PM Aldwin Pollefeyt > wrote: > > > > Wow, I'm so sorry I answered on the question : "How do you replace a > > variable with its value". For what i understood with the

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Chris Angelico
On Fri, Jul 12, 2019 at 2:30 PM Aldwin Pollefeyt wrote: > > Wow, I'm so sorry I answered on the question : "How do you replace a > variable with its value". For what i understood with the example values, > CrazyVideoGamez wants 3 variables named like the meal-names in

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Aldwin Pollefeyt
Wow, I'm so sorry I answered on the question : "How do you replace a variable with its value". For what i understood with the example values, CrazyVideoGamez wants 3 variables named like the meal-names in dictionary. Yes, it's not secure unless you work with your own datase

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Ben Finney
Aldwin Pollefeyt writes: > dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main > Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']} > > # Don't ask where I got the dinner from > > for meal in dinner.keys(): > exec(meal.replace(' ','_') + ' = list(dinner[meal])') > > print(S

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Chris Angelico
On Fri, Jul 12, 2019 at 4:37 AM Terry Reedy wrote: > > On 7/11/2019 12:51 AM, Aldwin Pollefeyt wrote: > > dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main > > Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']} > > > > # Don't ask where I got the dinner from > > > > for meal i

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Rhodri James
On 11/07/2019 05:51, Aldwin Pollefeyt wrote: dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']} # Don't ask where I got the dinner from for meal in dinner.keys(): exec(meal.replace(' ','_') + ' = list(dinner[meal])') p

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Terry Reedy
On 7/11/2019 12:51 AM, Aldwin Pollefeyt wrote: dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']} # Don't ask where I got the dinner from for meal in dinner.keys(): exec(meal.replace(' ','_') + ' = list(dinner[meal])')

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Aldwin Pollefeyt
dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']} # Don't ask where I got the dinner from for meal in dinner.keys(): exec(meal.replace(' ','_') + ' = list(dinner[meal])') print(Starters) print(Main_Course) print(Desert)

Re: How Do You Replace Variables With Their Values?

2019-07-10 Thread Frank Millman
On 2019-07-11 12:43 AM, CrazyVideoGamez wrote: How do you replace a variable with its value in python 3.7.2? For example, say I have: dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main Course':['Fish', 'Meat'], 'Dese

  1   2   3   4   5   6   7   8   9   10   >