0 answers

Python Mutliprocessing/Sockets - Bad File Descriptor

I am writing a server in Python which the client will send the command (via command line arg) "BYE". The connection between the client/server should be terminated at this time. (I figured that ...

0 answers

Python: dictionary key with two values

I have a dictionary that has keys with two values each. I need to update the second value as pass duplicate keys. Clearly what I'm trying isn't working out. if value1 not in dict.keys(): ...

0 answers

Spacing Two Things On The Same Line Then Writing To File

I am trying to write two things from two different files on the same line of a different file(That is there are 3 files being used. 2 that already have items and a new one ) ...

1 answer

Python: How to reset the turtle graphics window

I am a making a blackjack game with card using turtle and each time I play a hand turtle just prints over the last game instead of clearing the window. Is there a method that closes the window when it ...

1 answers | 5 mins ago by Allie Hart on Stack Overflow stackoverflow.com
0 answers

Python automatic dart scoring script, exit camera loop after 3 darts thrown

The following code detects a dart hitting a dartboard and gives a score after about a second. I recently had to switch to a live camera stream in order to achieve this as image analysis was to slow. ...

2 answers

sorting list of tuples doesnt work

This is my first question here =): My problem is what is stated in the title. I want to simply sort a list of tuples with 2 elements. It should work with sorted but it still returns the unsorted ...

2 answers | 9 mins ago by TheDude on Stack Overflow stackoverflow.com
1 answer

xml parsing (Removing parent nodes)

Hi I'm seriously stuck when trying to filter out my xml document. Here is some example of the contents: <sentence id="1" document_id="Perseus:text:1999.02.0029" > ...

1 answers | 14 mins ago by Molgate on Stack Overflow stackoverflow.com
0 answers

Does Indexing makes Slice of pandas dataframe faster?

I have a pandas dataframe holding more than million records. One of its columns is datetime. The sample of my data is like the following: time,x,y,z 2015-05-01 10:00:00,111,222,333 2015-05-01 ...

1 answer

theano (python): elementwise gradient

I'm trying to perform elementwise gradient with e.g., output-f(x): 5 by 1 vector, with respect to input-X: 5 by 1 vector I can do this like, X = T.vector('X') f = X*3 [rfrx, []] = ...

0 answers

PyQt5: phantom columns when using QTableView.setSortingEnabled and QSortFilterProxyModel

I have a custom Qt table model that allows a user to add both columns and rows after it's been created. I'm trying to display this table using a QSortFilterProxyModel / QTableView setup, but I'm ...

0 answers

iPython notebook not able to read in a data in memory

I have a dataset which I am fetching from Greenplum database and getting into ipython notebook. The dataset has 550K obs. The size of the dataset is 838MB. Here is screenshot of the same One ...

1 answer

Sort, averages & counters in a matrix

I'm having some trouble with the sorting of a matrix imported froma a text file in python. I've recieved some help but i'm stuck with the sorting (i don't know how to change rows in a matrix) and ...

0 answers

Python Gmail API contact form

I'm working on a personal website and I've been trying to use the Gmail API to send mail to my account from a contact form on the site. I can send mail through cmd but whenever I have the form call ...

7 answers

Concatenate strings at the same indexes in two lists

I have two lists and I'd like to combine them following the same order. Below is the question. A = ['1,2,3','4,5,6','7,8,9'] B = ['10','11','12'] To get a new list such as below A+B = ...

7 answers | 30 mins ago by Sakura on Stack Overflow stackoverflow.com
1 answer

matplotlib LogFormatterExponent — 'e' in the exponent labels of cbar

So I'm modifying someone else's library to setup a cbar with log (values). I thought I could use LogFormatterExponent() ... But it seemingly randomly adds and 'e' to the exponents that it uses for the ...

1 answers | 32 mins ago by earnric on Stack Overflow stackoverflow.com
0 answers

how to return a value to the main function after clicking a button in tkinter?

In this file, I tried to return the value of employNum and employPass to the main function each time I clicked the display button. How can I do that? from tkinter import * def ...

0 answers

Python sorting on the fly conversion to custom class

I am working with Autodesk Maya and PyMel, which has custom classes for representation of its vertices. Within that MeshVertex class is a Point class, which specifies the x, y, z coordinates of the ...

2 answers

Numpy loadtxt remove leading zeros (convert) and define spaces delimiter

I have files with XYZ coordinates generated by some software in the way of fixed column widths including spaces and leading zeros: 00666666.66 07777777.77 0000333.33 Using line: data = ...

2 answers | 35 mins ago by Miro on Stack Overflow stackoverflow.com
0 answers

How can I draw 10 square in different color and smaller

This is what my patch looks like. Is there a simple way to make these 10 square by. If I want to loop this patch. Different block have different size of square. for i in range(5): win = ...

1 answer

How to scatter plot a dict of lists containing arrays in Matplotlib? (Screenshot in details)

What I want to do is plotting data in a dict, preferably using Matplotlib. Below is a screenshot since I think looking at the data structure makes it easier to understand. But here is also a ...

1 answer

how to change feature weight when training a model with sklearn?

I want to classifier text by using sklearn. first I used bag of words to training the data, the feature of bag of words are really large, more than 10000 features, so I reduced this feature by using ...

4 answers

How to install python packages without root privileges?

I am using numpy / scipy / pynest to do some research computing on Mac OS X. For performance, we rent a 400-node cluster (with Linux) from our university so that the tasks could be done parallel. The ...

1 answer

Saving Celery tasks to a Djago backend - clearing some confusions

I started working with Celery and integrated it with Django, where I have the latest versions of both. Celery is configured in settings.py like so: # Celery settings BROKER_URL = ...

3 answers

How to optimize word_count in python

I am given n words (1≤n≤10^5). Some words may repeat. For each word, I have to output its number of occurences. But the output order should correspond with the order of the first appearance of the ...

0 answers

Python and openpyxl - Changing column width to fit?

Say I had a workbook, and I wanted to make sure that all columns are readable; how would I determine the width the column needs to be from a cell's text, to then change the width of the column?

0 answers

Normalize values in DataFrame

I have this data frame: user rating review_id ---l5p2MM0KIPWKhOy8SYg sjpVZwAX8gQSH82AGyig4Q 5 ---mvnodbrJnF3GbBdkV5g v00s9U3GNSn8gMFngRW-qQ 4 ...

1 answer

Building a “deck” in python

I've just started learning to program and am now attempting to write a blackjack program. A problem I've come across is in my way of representing a deck, here's how I did it (the suit doesn't matter ...

1 answers | 55 mins ago by Max Werman on Stack Overflow stackoverflow.com
1 answer

close method of Tornado's WebsocketClientConnection doesn't invoke on_close method of Websocket Handler

I have a WebsocketHandler like this: class MyHandler(WebSocketHandler): def open(self, *args, **kwargs): self.application.logger.info('WebSocket connection opened from %s', ...

1 answers | 56 mins ago by mehdy on Stack Overflow stackoverflow.com
0 answers

C++/RapidJSON: Removing unicode Python prefix from JSON string for parsing

I have a Python web API that returns a JSON with the "u" prefix instead of the standard double quotes. I want to be able to parse this in C++ using the RapidJSON document.Parse(string) function, ...

1 answer

Pyro - Preventing NameServer from raising socket.error Address already in use

I'm trying to harden a Pyro application for production. I am running into the following issue with the Name Server. If the Name Server is turned off and rapidly turned back on, there seems to be a ...

15 30 50 per page
1 2 3