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
--
À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
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:
> ...
>
>>
>>
À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
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
À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)
this message in context:
http://old.nabble.com/Pickle-problem-while-loading-a-class-instance.-tp28154964p28197881.html
Sent from the Python - python-list mailing list archive at Nabble.com.
--
http://mail.python.org/mailman/listinfo/python-list
En Fri, 09 Apr 2010 18:42:23 -0300, gerardob gberbeg...@gmail.com
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?
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 script
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 this message in context:
http://old.nabble.com/Pickle-problem-while-loading-a-class-instance.-tp28154964p28154964
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 =
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
On Mar 4, 2:49 pm, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 4, 1:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On
Fab86 wrote:
On Mar 4, 2:49 pm, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 4, 1:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86
On Mar 4, 1:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
How
Fab86 wrote:
On Mar 4, 1:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar
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
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)
On Tue, Mar 3, 2009 at 1:52 AM, Fab86 fabien.h...@gmail.com 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)
On Mar 3, 10:34 am, Chris Rebert c...@rebertia.com wrote:
On Tue, Mar 3, 2009 at 1:52 AM, Fab86 fabien.h...@gmail.com 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 =
Fab86 fabien.h...@gmail.com 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
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 =
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')
print f, 123
Fantastic, just what I was looking for Andrew.
Many thanks,
Fabien
On Mar 3, 11:50 am, andrew cooke and...@acooke.org 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
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:00
On Mar 3, 4:16 am, Fab86 fabien.h...@gmail.com 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,
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_available
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
On Mar 3, 1:02 pm, MRAB goo...@mrabarnett.plus.com 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 =
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 fabien.h...@gmail.com 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
On Mar 3, 6:48 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 fabien.h...@gmail.com 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
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 3, 6:48 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 fabien.h...@gmail.com
escribió:
I am having a bit on an issue getting my program to work. The online
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 3, 6:48 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 fabien.h...@gmail.com
escribió:
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 module
except SearchError:
NameError: name 'SearchError' is
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 3, 6:48 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 fabien.h...@gmail.com
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 3, 6:48 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue,
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
How to spell exactly the exception name should appear in the
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 the standard
lib
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:
The thing is, I'm not
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 communication,
[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 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 them
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
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 the
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 slots.
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 slots.
`socket`
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
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 parent
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 root
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
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
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
object,
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
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):
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 call the
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 access
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__(self):
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__(self):
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
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 on
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) ...:
| The
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
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
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 breaking up
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 breaking up
67 matches
Mail list logo