14 answers

How to get time of a python program execution?

I have a command line program in Python that takes a while to finish. I want to know the exact time it takes to finish running. I've looked at the timeit module, but it seems it's only for small ...

14 answers | 1 min ago by john2x on Stack Overflow stackoverflow.com
0 answers

Font will not set in reportlab text object

Im having trouble getting the font to set in reportlab. I set the canvas and the text object to Courier, size 9, but when I open the resulting document the text is all Ariel, size 12. I know exactly ...

1 answer

python how to use mailchimp to send email

I have been reading a lot on internet to know how can i use python to send emails using mailchimp api it seems that the website is so complected and doesn't have any example, please could you guide ...

0 answers

Django-CKEditor Widget not loading dynamically

I am having problem on loading the second and next ckeditor widget on the front-end form in html. It works well in admin. When I click add more form set dynamically, the widget not come out but ...

0 answers

Solution - How to use String format to create HTML report

Hi Guys I faced issue 2 weeks ago and I thought this worth sharing with you . I had a csv file and I wanted to generated some data out of this file.The issue was that I couldn't find any easy, ...

1 answer

QWebpage only fetches HTML once, and cannot be invoked again

I have a code: from PyQt4 import QtCore from PyQt4.QtWebKit import QWebPage from PyQt4.QtGui import QApplication class TextBrowser(QtCore.QObject): def __init__(self, url): ...

1 answers | 4 mins ago by Matvey on Stack Overflow stackoverflow.com
5 answers

Is there a “not equal” operator in Python?

How would you say does not equal? Like if hi == hi: print "hi" elif hi (does not) bye: print "no hi" Is there a replacement for == that means "not equal"?

5 answers | 4 mins ago by Aj Entity on Stack Overflow stackoverflow.com
2 answers

Python Pandas: How to optimally compare each value of a dictionary with all other values?

I have a dictionary 'orgs_dict', and I would like to compare each value with all of the values, for that I put all of the values in a set and then did a comparison, if they are the same I add it to ...

0 answers

Splinter - How to click a link / button implemented as a div or span element

I am using the Splinter library in Python. I wish to click on a link according to the link text, but this is not working. The link is included in the source like: <a href="link here"><span ...

2 answers

Python: WTForms Can I add a placeholder attribute when I init a field?

I want to add a placeholder attribute on to the field in WTForms. How can I do it? abc = TextField('abc', validators=[Required(), Length(min=3, max=30)], placeholder="test") The above code is not ...

2 answers | 8 mins ago by Kit Ho on Stack Overflow stackoverflow.com
0 answers

Django: reload form data after db values change

I have a Django form that generates input "number" fields from values of database with storehouse items. After processing all the input data is stored in a temporary database. Because of that, the ...

1 answer

Resloving TypeError in Python Code

I'm basically running some code as follows. Basically I'm just retrieving pairs of stocks (laid out as Row 1-Stock 1,2, Row 2-Stock 1,2 and so on, where Stock 1 and 2 are different in each row) from ...

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

Check whether domain is registered

I'm trying to make a script which would return not registered domains. I'm working in Python 2.7. I've read that module whois should be able to do that but the code I've written raises error. import ...

2 answers | 11 mins ago by Milan on Stack Overflow stackoverflow.com
1 answer

Pandas Series Boolean operation on integers only

I parsed a series of Excel files as df using Pandas. In a given column, I'm trying to get the index of the maximum value below a certain value (7000). ...

0 answers

Python error in SVM classifier.predict()

I am getting the following error when i perform classification of new data with the following command in Python: classifier.predict(new_data) AttributeError: python 'SVC' object has no attribute ...

0 answers

Object detection in images (HOG)

I want to detect objects inside cells of microscopy images. I have a lot of annotated images (app. 50.000 images with an object and 500.000 without an object). So far I tried to extract features ...

0 answers

Python requests isn't giving me the same HTML as my browser is

I am grabbing a Wikia page using Python requests. There's a problem, though: the requests request isn't giving me the same HTML as my browser is with the very same page. For comparison, here's the ...

1 answer

ImportError: No Module Named 'pysqlite2'

I have written a program in Python which was done on windows. And in the windows test environment worked fine. Now I am setting up a linux server to internally host the program. I have installed all ...

0 answers

Unstack a MultiIndex pandas DataFrame counter-clockwise instead of clockwise

I have a multiindex pandas DataFrame that looks like this: Number of Vulnerabilities Name Severity moderate 2167 Person 1 high 1421 ...

1 answer

Python Writing 'N' bytes data to Binary file

I have following data in Excel sheet, 1st column is number of bytes, 2nd column is its data (dat is in decimal,hex,ip address format) Question is how to write these into binary file, like in 1 ...

0 answers

Serializing NotificationQuerySet from django-notifications-hq not working

So, i'm trying to add to my API made with DRF (Django REST Framework) the notifications Model, but i'm getting this error: AttributeError: 'NotificationQuerySet' object has no attribute 'recipient' ...

2 answers

Get Whole String From a Struct Pack in Python?

What I am trying to do is to get a full length string from a Python struct. Here is my struct: struct.pack('6s','Hello!') Which is 'Hello!'. But, when I am doing struct.unpack('s','Hello!') I get an ...

2 answers | 20 mins ago by Cold Diamondz on Stack Overflow stackoverflow.com
0 answers

How to save reference collection on GenericReferenceField value?

class Log(Document): ref = GenericReferenceField() user = ReferenceField('User') log_type = StringField() # film or book or ... action = StringField() # insert or update or ...

0 answers

Train corpus of negative and positive Tweets for Sentiment Analysis, using NLTK for Python

I have two textfiles: one containing 25K positive tweets, separated on every line, and the second one 25K negative tweets, separated on every line. How can I use these two text files to create a ...

3 answers

How to search for a Xml node with a given attribute value in python

I have this XML file and I want to get the country nodes which have the pattern 'in' in their name. <?xml version="1.0"?> <data> <country name="Liechtenstein"> ...

3 answers | 23 mins ago by Abhishek Moondra on Stack Overflow stackoverflow.com
1 answer

How to find the maximum of a prob in PuLP

I am trying to solve a linear problem in PuLP that minimizes a cost function. The cost function is itself a function of the maximum value of the cost function, e.g., I have a daily cost, and I am ...

1 answers | 23 mins ago by Adam on Stack Overflow stackoverflow.com
1 answer

Can i use a Graph-Algorithm on Yed-Graphs with python?

I am using Yed to paint some graphs as shown in the picture below. Is there a way I can use python to compute a Depth-First exploration on these? I would like the algorithm to protocol the Edges he ...

0 answers

Error when installing igraph for Python

I am trying to install igraph for Python by using the following command brew install homebrew/science/igraph I am using a macbook pro with OS X 10.10.2. I already update to the last version of ...

1 answer

Setting a threshold in classifier output in Python

Assuming I have a trained SVM classifier in Python with the flag "Probability=True" as: classifier = SVC(C = 1000000, gamma = 10, probability=True) classifier.fit(my_data, the_labels) When I ...

1 answers | 27 mins ago by gelazari on Stack Overflow stackoverflow.com
0 answers

Most intelligent way of reading some data into Python

The following link has some data released by the US Fed: http://www.federalreserve.gov/monetarypolicy/fomcprojtabl20150318.htm I copied and pasted the last table on that link to a spreadsheet in ...

15 30 50 per page
1 2 3