Python: plot data from a txt file
How do I plot a histogram of this kind of data, 10 apples 3 oranges 6 tomatoes 10 pears from a text file? thanks ...
How do I plot a histogram of this kind of data, 10 apples 3 oranges 6 tomatoes 10 pears from a text file? thanks ...
In sqlite3 there is this table: create table t(d double) In python, the code is: sqlite3.register_converter('double', Decimal) ... for d, in connection.execute('select d from t limit 1'): print type(d) The printed result is: <type 'float'> Any idea why? ...
I need to import some data to show it for user but page execution time exceeds 30 second limit. So I decided to split my big code into several tasks and try Task Queues. I add about 10-20 tasks to queue and app engine executes tasks in parallel while user is waiting for data. How can I determine that my tasks are completed to show user d...
I have pydbgr working well now in Emacs 23.2 with virtualenv. But I am confused why breakpoints are not established from the source code buffer after running M-x pydbgr - as they would be e.g. when using pdb. I tried invoking C-cC-b but this does not toggle breakpoints on the selected line as one would hope/expect. Neither does C-xSP...
From the tests I've done, with the same version of python (same magic number), a 64 bit interpreter can load pyc files made with a 32 bit version of python. And reciprocally I assume. But is it totally safe? Can this lead to unexpected behavior? ...
Is it possible and safe to load pyc files made with a different minor version of python? For instance 2.5.1 with 2.5.5? My guess is that the magic number does not change with minor versions. If I refer to this file import.c the magic number corresponds to the variable pyc_magic ( equals MAGIC or MAGIC+1 ) The file comments say: Mag...
I would like to install Python 2.5.5 to use with Google apps but have been having a very hard time tracking down instructions on how to do so. I am thinking the following might work but was wondering if anyone had successfully built it? ./configure --prefix=/usr/local/python2.5.5 MACOSX_DEPLOYMENT_TARGET=10.6 --enable-framework --with-u...
I have a bunch of numbers that I want to print to the user. Each number is greater than one million so I want to print it as 1.000.000 or 1,000,000 (any of these forms is valid to me). I want to know if is it possible to format integer numbers this way in python using the built-in formating utilities. ...
i wrote a py script to fetch page from web,it just read write permission enough,so my question is when we need execute permission? ...
Hi, I'm trying to upload a file to Google storage, but my code freezes and does not respond. Please help me. Mycode : def PutFile(self,filename): conn = httplib.HTTPConnection("%s.commondatastorage.googleapis.com" % self.bucket) conn.set_debuglevel(2) dd = "%s" % datetime.datetime.utcnow().strftime("%a, %d %b %Y %H:%M:%...
how can I interrupt python execution with a key and continue to run when the key is pressed again ? thanks ...
If I have a pool object with 2 processors for example: p=multiprocessing.Pool(2) and I want to iterate over a list of files on directory and use the map function could someone explain what is the chunksize of this function: p.map(func, iterable[, chunksize]) If I set the chunksize for example to 10 does that means every 10 files s...
Forgive me if this has been asked before. I did not know how to search for it. I'm quite familiar with the following idiom: def foo(): return [1,2,3] [a,b,c] = foo() (d,e,f) = foo() wherein the values contained within the left hand side will be assigned based upon the values returned from the function on the right. I also know...
I want to pass an instance of a mapped class to a non-SQLAlchemy aware method (in another process) and only need the values of my attributes. The problem is, that an UnboundExecutionError occurs, every time the method wants to read an attribute value. I do understand, why this happens, but I would like to have a solution for this problem...
I am trying to create a Django admin filter that will get random groups of users. At this point, I have two problems: Applying a custom filter to the User model, and Displaying a random set of users. On #1, I've tried using User.username.random_filter = True, but it comes back with an AttributeError saying that User has no attribute ...
Hi, Using Python 2.6 I want to be able to convert numbers such as 00000, 000.00004 and 001 to strings. Such that each string is '00000', '000.00004' and '001' respectively. It is also necessary that the way to do this is the same with all numbers, and also copes when letters are fed into it. E.g. foo should become 'foo', 2bar should b...
this is from the 'python cookbook' but isn't explained that well. allchars = string.maketrans('','') def makefilter(keep): delchars = allchars.translate(allchars, keep) def thefilter(s): return s.translate(allchars,delchars) return thefilter if __name__ == '__main__': just_vowels = makefilter('aeiou') print ...
I trying find a simple python-based algorithmic ranking system. Here's the scenario: There will be 30 levels, level 1 starts at 0 points. 2000 points are required to achieve level 30. More points will be required as the levels progress. For example, to go from level 1 to 2 might take 3 points. Level 2 to 3 might take 5 additional poi...
I seem to be getting an IOError: request data read error quite a lot when i'm doing an Ajax upload. For example out of every 5 file uploads it errors out on atleast 3. Other people seem to have had the same issue. Eg. http://stackoverflow.com/questions/2641665/django-upload-failing-on-request-data-read-error http://stackoverflow.com...
The situation is that I have a small datacenter, with each server running python instances. It's not your usual distributed worker setup, as each server has a specific role with an appropriate long-running process. I'm looking for good ways to implement the the cross-server communication. REST seems like overkill. XML-RPC seems nice, bu...