On 04/21/2016 11:43 PM, Paulo da Silva wrote:
class C(pd.DataFrame):
Note also that subclassing pandas is not always encouraged:
http://pandas.pydata.org/pandas-docs/stable/internals.html#subclassing-pandas-data-structures
Cheers,
Fabien
--
https://mail.python.org/mailman/listinfo/python-lis
Às 21:33 de 22-04-2016, Ian Kelly escreveu:
> On Fri, Apr 22, 2016 at 2:21 PM, Paulo da Silva
> wrote:
...
>
> If they start with two underscores then you could use the name
> mangling to find them. If the class name is MyClass then look for any
> keys in the instance dict that start with '_MyCla
On Fri, Apr 22, 2016 at 2:21 PM, Paulo da Silva
wrote:
> Às 17:27 de 22-04-2016, Ian Kelly escreveu:
>> On Thu, Apr 21, 2016 at 7:52 PM, Paulo da Silva
>> wrote:
>>> Às 22:43 de 21-04-2016, Paulo da Silva escreveu:
> ...
>
>>
>> Probably this is necessary because the DataFrame class is already
>>
Às 17:27 de 22-04-2016, Ian Kelly escreveu:
> On Thu, Apr 21, 2016 at 7:52 PM, Paulo da Silva
> wrote:
>> Às 22:43 de 21-04-2016, Paulo da Silva escreveu:
...
>
> Probably this is necessary because the DataFrame class is already
> customizing its pickle behavior without taking into account the
>
On Thu, Apr 21, 2016 at 7:52 PM, Paulo da Silva
wrote:
> Às 22:43 de 21-04-2016, Paulo da Silva escreveu:
>> Hi.
>>
>> Why in this code fragment self.__name is not kept between pickle
>> dumps/loads? How to fix it?
>>
>> Thanks.
>>
>> import pickle
>> import pandas as pd
>> import numpy as np
>>
>
Às 22:43 de 21-04-2016, Paulo da Silva escreveu:
> Hi.
>
> Why in this code fragment self.__name is not kept between pickle
> dumps/loads? How to fix it?
>
> Thanks.
>
> import pickle
> import pandas as pd
> import numpy as np
>
> class C(pd.DataFrame):
> def __init__(self,name,*a,**b):
>
Hi.
Why in this code fragment self.__name is not kept between pickle
dumps/loads? How to fix it?
Thanks.
import pickle
import pandas as pd
import numpy as np
class C(pd.DataFrame):
def __init__(self,name,*a,**b):
super(C,self).__init__(*a,**b)
self.__name
gerardob wrote:
>
> I tried both things:
>
> 1- moved all the code to C:/Python26/lib/site-packages
> 2- Modified the PYTHONPATH in the windows registry.
>
> However, i stil have exactly the same error on the screen.
>
> Any other suggestions?
Did you heed my advice and make sure that your sc
En Fri, 09 Apr 2010 18:42:23 -0300, gerardob
escribió:
I tried both things:
1- moved all the code to C:/Python26/lib/site-packages
2- Modified the PYTHONPATH in the windows registry.
However, i stil have exactly the same error on the screen.
Any other suggestions?
Did you follow the advi
858, in load
>> dispatch[key](self)
>> File "C:\Python26\lib\pickle.py", line 1090, in load_global
>> klass = self.find_class(module, name)
>> File "C:\Python26\lib\pickle.py", line 1124, in find_class
>> __import__(module)
>> Impor
On 04/07/10 03:23, gerardob wrote:
> The error below appears. In the case i remove the comment to initialize m2,
> the same thing happens. Any ideas on how to fix this?
>
When unpickling a user-defined class, you unpickling module must have
access to the original class definition. This means if
gerardob wrote:
> Hello, I am new to python and i have a problem using the pickle load
> function.
> I have an object m of the class MarkovModel and i want to copy it to a
> file and load it onto another class:
>
> l=[1,2,3]
> m = markov_model.MarkovModel()
> m.load_observations(l)
> file = open(
line 858, in load
dispatch[key](self)
File "C:\Python26\lib\pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "C:\Python26\lib\pickle.py", line 1124, in find_class
__import__(module)
ImportError: No module named markov_model
--
View thi
Fab86 wrote:
On Mar 4, 2:49 pm, MRAB wrote:
Fab86 wrote:
On Mar 4, 1:40 am, "Gabriel Genellina" wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió:
On Mar 4, 12:00 am, MRAB wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
How to "spell" exactly the exception nam
On Mar 4, 2:49 pm, MRAB wrote:
> Fab86 wrote:
> > On Mar 4, 1:40 am, "Gabriel Genellina" wrote:
> >> En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió:
>
> >>> On Mar 4, 12:00 am, MRAB wrote:
> Fab86 wrote:
> > On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
> >> How to "spell" exa
Fab86 wrote:
Is there another way rather than closing the file? Is it possible to
delete all within the file?
Thanks
Delete the old file then opening (and creating) it again is the easiest
way? If you need the data from the old file, you can rename the old file
and reopen (and create) a new
Fab86 wrote:
On Mar 4, 1:40 am, "Gabriel Genellina" wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió:
On Mar 4, 12:00 am, MRAB wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
How to "spell" exactly the exception name should appear in the
documentation; migh
On Mar 4, 1:40 am, "Gabriel Genellina" wrote:
> En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió:
>
>
>
> > On Mar 4, 12:00 am, MRAB wrote:
> >> Fab86 wrote:
> >> > On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
> >> >> How to "spell" exactly the exception name should appear in the
> >> >> d
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 escribió:
On Mar 4, 12:00 am, MRAB wrote:
Fab86 wrote:
> On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
>> How to "spell" exactly the exception name should appear in the
>> documentation; might be yahoo.SearchError, or
yahoo.search.SearchError,
On Mar 4, 12:00 am, MRAB wrote:
> Fab86 wrote:
> > On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
> >> En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 escribió:
>
> >>> On Mar 3, 6:48 pm, "Gabriel Genellina" wrote:
> En Tue, 03 Mar 2009 16:39:43 -0200, Fab86
> escribió:
> > I am havin
Fab86 wrote:
On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 escribió:
On Mar 3, 6:48 pm, "Gabriel Genellina" wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86
escribió:
I am having a bit on an issue getting my program to work. The online
databas
On Tue, 2009-03-03 at 15:33 -0800, Fab86 wrote:
> I have been trying except SearchError: however I get the error:
>
> Traceback (most recent call last):
> File "C:\Downloads\MoS\yws-2.12\Python\pYsearch-3.1\timeDelay.py",
> line 19, in
> except SearchError:
> NameError: name 'SearchError' i
On Mar 3, 8:59 pm, "Gabriel Genellina" wrote:
> En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 escribió:
>
>
>
> > On Mar 3, 6:48 pm, "Gabriel Genellina" wrote:
> >> En Tue, 03 Mar 2009 16:39:43 -0200, Fab86
> >> escribió:
>
> >> > I am having a bit on an issue getting my program to work. The onli
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 escribió:
On Mar 3, 6:48 pm, "Gabriel Genellina" wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86
escribió:
> I am having a bit on an issue getting my program to work. The online
> database which I am trying to contact keep timing out meaning I can
On Mar 3, 6:48 pm, "Gabriel Genellina" wrote:
> En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 escribió:
>
> > I am having a bit on an issue getting my program to work. The online
> > database which I am trying to contact keep timing out meaning I can
> > not carry out my 200 searches without being in
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 escribió:
I am having a bit on an issue getting my program to work. The online
database which I am trying to contact keep timing out meaning I can
not carry out my 200 searches without being interupted.
I believe that the solution would be to include a
On Mar 3, 1:02 pm, MRAB wrote:
> Fab86 wrote:
> > I am getting res1 and res2 etc from this code:
>
> > srch1 = WebSearch(app_id=YahooKey)
> > srch1.query = "avoir site:.al"
> > res1 = srch1.parse_results()
>
> > srch2 = WebSearch(app_id=YahooKey)
> > srch2.query = "avoir site:.fr"
> > res2 = srch2
Fab86 wrote:
I am getting res1 and res2 etc from this code:
srch1 = WebSearch(app_id=YahooKey)
srch1.query = "avoir site:.al"
res1 = srch1.parse_results()
srch2 = WebSearch(app_id=YahooKey)
srch2.query = "avoir site:.fr"
res2 = srch2.parse_results()
After identifying res1, I then use the total
I am getting res1 and res2 etc from this code:
srch1 = WebSearch(app_id=YahooKey)
srch1.query = "avoir site:.al"
res1 = srch1.parse_results()
srch2 = WebSearch(app_id=YahooKey)
srch2.query = "avoir site:.fr"
res2 = srch2.parse_results()
After identifying res1, I then use the total_results_availa
On Mar 3, 4:16 am, Fab86 wrote:
> Thanks, this seems like a simpler way to do it.
>
> I plan on recording 200 values to this file from the outcome of 200
> Yahoo searches. Is there any type of loop I can make to do this or do
> I have to have a line like "print >> f, res1.total_results_available"
Thanks, this seems like a simpler way to do it.
I plan on recording 200 values to this file from the outcome of 200
Yahoo searches. Is there any type of loop I can make to do this or do
I have to have a line like "print >> f, res1.total_results_available"
200 times?
Regards,
Fabien
On Mar 3, 12
Fantastic, just what I was looking for Andrew.
Many thanks,
Fabien
On Mar 3, 11:50 am, "andrew cooke" wrote:
> Fab86 wrote:
> > I am wanting to store the integers in a file so that I can then run it
> > through some software without having to edit it. Will json enable me
> > to do this?
>
> no.
maybe the following are simpler as they use print
if you are using python 2.6 or python 3:
>>> from __future__ import print_function
>>> f = open('myfile.txt', 'w')
>>> print(123, file=f)
>>> print(456, file=f)
>>> f.close()
alternatively, in python 2.5 or 2.6:
>>> f = open('myfile.txt', 'w'
Fab86 wrote:
> I am wanting to store the integers in a file so that I can then run it
> through some software without having to edit it. Will json enable me
> to do this?
no. ignore json - it is for something else entirely.
all you need to do is to write the numbers out to a file:
f = open('fil
Fab86 writes:
> when trying to pickle them they are displayed like this:
>
> I14
> .I15200
> .I86000
> .
>
> But in console simply printing these attributes I get:
>
> 14
> 15200
> 86000
>
> Can anyone help?
Can you describe the problem in some detail? Everything seems to be
working fi
On Mar 3, 10:34 am, Chris Rebert wrote:
> On Tue, Mar 3, 2009 at 1:52 AM, Fab86 wrote:
> > Hello,
>
> > I am new to using Python and am looking at exporting some of my code
> > into a seperate document.
>
> > The code I am using for the pickle is:
>
> > file = open('testdoc.txt', 'w')
>
> > pickl
On Tue, Mar 3, 2009 at 1:52 AM, Fab86 wrote:
> Hello,
>
> I am new to using Python and am looking at exporting some of my code
> into a seperate document.
>
> The code I am using for the pickle is:
>
> file = open('testdoc.txt', 'w')
>
> pickle.dump(res1.total_results_available,file)
> pickle.dump
Hello,
I am new to using Python and am looking at exporting some of my code
into a seperate document.
The code I am using for the pickle is:
file = open('testdoc.txt', 'w')
pickle.dump(res1.total_results_available,file)
pickle.dump(res2.total_results_available,file)
pickle.dump(res3.total_resul
On May 11, 6:21 pm, [EMAIL PROTECTED] wrote:
> On May 8, 7:29 pm, [EMAIL PROTECTED] wrote:
>
>
>
>
>
> > On May 8, 4:35 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
>
> > > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>
> > > > On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
>
> > >
On May 8, 7:29 pm, [EMAIL PROTECTED] wrote:
> On May 8, 4:35 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
>
>
>
> > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>
> > > On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
>
> > >> The thing is, I'm not using slots by choice. I'm using t
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>> Of course, if it makes sense to pickle sockets in the application, one
>> is can do so by defining __getstate__ and __setstate__:
>
> When does it make sense!?
When recreating the object from on-disk state requires reestablishing
the communi
On Thu, 08 May 2008 23:35:04 +0200, Hrvoje Niksic wrote:
> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>
>> On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
>>
>>> The thing is, I'm not using slots by choice. I'm using the standard
>>> lib "socket" class, which apparently uses sl
On May 8, 4:35 pm, Hrvoje Niksic <[EMAIL PROTECTED]> wrote:
> Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
>
> > On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
>
> >> The thing is, I'm not using slots by choice. I'm using the standard
> >> lib "socket" class, which apparently uses
Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> writes:
> On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
>
>> The thing is, I'm not using slots by choice. I'm using the standard
>> lib "socket" class, which apparently uses slots.
>
> `socket` objects can't be pickled. Not just because of t
On Thu, 08 May 2008 08:55:35 -0700, krustymonkey wrote:
> The thing is, I'm not using slots by choice. I'm using the standard
> lib "socket" class, which apparently uses slots.
`socket` objects can't be pickled. Not just because of the `__slot__`\s
but because a substantial part of their state
On May 8, 5:48 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > I'm wondering if anyone can help with a workaround for a problem I
> > currently have. I'm trying to set up a prefork tcp server.
> > Specifically, I'm setting up a server that forks children and has th
[EMAIL PROTECTED] wrote:
> I'm wondering if anyone can help with a workaround for a problem I
> currently have. I'm trying to set up a prefork tcp server.
> Specifically, I'm setting up a server that forks children and has them
> listen on pipes created with os.pipe(). The parent process for the
On May 7, 11:02 pm, [EMAIL PROTECTED] wrote:
> I'm wondering if anyone can help with a workaround for a problem I
> currently have. I'm trying to set up a prefork tcp server.
> Specifically, I'm setting up a server that forks children and has them
> listen on pipes created with os.pipe(). The par
I'm wondering if anyone can help with a workaround for a problem I
currently have. I'm trying to set up a prefork tcp server.
Specifically, I'm setting up a server that forks children and has them
listen on pipes created with os.pipe(). The parent process for the
group starts an inet:tcp server o
Dear Jerry and George:
it works like a charm! I always thought that the first way was a
quicker alternative to defining the init method... shame on me!
>From now on I'll read the list every day repeating to myself:
"Premature optimization is the root of all evil", "Premature
optimization is the ro
On Apr 18, 11:55 am, "Mario Ceresa" <[EMAIL PROTECTED]> wrote:
> Hello everybody:
> I'd like to use the pickle module to save the state of an object so to
> be able to restore it later. The problem is that it holds a list of
> other objects, say numbers, and if I modify the list and restore the
> o
On Fri, Apr 18, 2008 at 11:55 AM, Mario Ceresa <[EMAIL PROTECTED]> wrote:
> Hello everybody:
> I'd like to use the pickle module to save the state of an object so to
> be able to restore it later. The problem is that it holds a list of
> other objects, say numbers, and if I modify the list and r
Hello everybody:
I'd like to use the pickle module to save the state of an object so to
be able to restore it later. The problem is that it holds a list of
other objects, say numbers, and if I modify the list and restore the
object, the list itself is not reverted to the saved one, but stays
with o
Hi,
I used code similar to the one at
http://www.onlamp.com/pub/a/python/2006/02/09/ai_decision_trees.html in
order to build an ID3 decision tree using python. I obviously do not want to
rebuild this tree every time i need to use it! so i tried to save it using
pickle, after building it:
>from cP
> I'm trying to make the transition from Java
> The biggest thing that was messing me up was the
> mandatory "self" input. For some reason I was thinking
> that, if I had parenthesis, I would have to define it.
I think things are pretty similar in Java. Java does the same thing
except 'self' is
Gary Herron <[EMAIL PROTECTED]> wrote:
...
> fixed, I see another bit of trouble. The pickle format is a binary
> format (be default), but you don't open the file in binary mode. On
Alas, wish it were:-(.
Unfortunately, snipping the right snippet from help(pickle) ...:
"""
| Th
On Mar 15, 10:38 am, Gary Herron <[EMAIL PROTECTED]> wrote:
> tonyr1988 wrote:
> > I'm a complete python n00b writing my first program (or attempting to,
> > anyway). I'm trying to make the transition from Java, so if you could
> > help me, it would be greatly appreciated. Here's the code I'm stuck
Hi,
You should write your last two lines as ...
x = DemoClass()
x.WriteToFile()
Don't miss paranthesis again... :)
Maybe there are still some mistakes too. Does dump method writes list's
elements?
Sönmez
tonyr1988 wrote:
> I'm a complete python n00b writing my first program (
tonyr1988 wrote:
> I'm a complete python n00b writing my first program (or attempting to,
> anyway). I'm trying to make the transition from Java, so if you could
> help me, it would be greatly appreciated. Here's the code I'm stuck on
> (It's very basic):
>
> class DemoClass:
> def __init__(s
On 15 Mar 2007 08:13:53 -0700, tonyr1988 <[EMAIL PROTECTED]> wrote:
> if __name__=='__main__':
> x = DemoClass
> x.WriteToFile
Here, you're binding the Class DemoClass to the name x. What you
probably meant to do is create a new instance of DemoClass, and bind
that to name x, like
tonyr1988 wrote:
> I'm a complete python n00b writing my first program (or attempting to,
> anyway). I'm trying to make the transition from Java, so if you could
> help me, it would be greatly appreciated. Here's the code I'm stuck on
> (It's very basic):
>
> class DemoClass:
> def __init__(
In <[EMAIL PROTECTED]>, tonyr1988
wrote:
> if __name__=='__main__':
> x = DemoClass
> x.WriteToFile
In Python classes, functions and methods are first class objects. You
bind the `DemoClass` class object to the name `x`, you are *not* creating
an instance of `DemoClass`.
Then you ac
On Mar 15, 11:13 am, "tonyr1988" <[EMAIL PROTECTED]> wrote:
> if __name__=='__main__':
> x = DemoClass
> x.WriteToFile
>
You meant to create a DemoClass instance object, but instead, you
obtained a reference to the class object. You want 'x = DemoClass()'
instead.
You meant to ca
I'm a complete python n00b writing my first program (or attempting to,
anyway). I'm trying to make the transition from Java, so if you could
help me, it would be greatly appreciated. Here's the code I'm stuck on
(It's very basic):
class DemoClass:
def __init__(self):
self.t
ahaldar wrote:
> Hi:
>
> I have some large data structure objects in memory, and when I attempt
> to pickle them, I get the following error:
>
> SystemError: frexp() out of range
>
> Are there some objects that are just too large to serialize, and if
> so, is there an easy workaround without breaki
ahaldar wrote:
> Hi:
>
> I have some large data structure objects in memory, and when I attempt
> to pickle them, I get the following error:
>
> SystemError: frexp() out of range
>
> Are there some objects that are just too large to serialize, and if
> so, is there an easy workaround without bre
Hi:
I have some large data structure objects in memory, and when I attempt
to pickle them, I get the following error:
SystemError: frexp() out of range
Are there some objects that are just too large to serialize, and if
so, is there an easy workaround without breaking up the object and
reconstru
67 matches
Mail list logo