Interesting Tags
   11 tags on

1 answer

Splitting a “.txt” file

I have data from a ".txt" file coming in, in the form a of a comma separated list. For example: N12345678,B,A,D,D,C,B,D,A,C,C,D,B,A,B,A,C,B,D,A,C,A,A,B,D,D ...

1 answers | 1 min ago by Danny Garcia on Stack Overflow
0 answers

Python sunlight openstates api

import requests def call(): payload = {'apikey':'myapikey', 'zip':'74120'} bas_url = '' r = requests.get(bas_url, params = payload) grab = r.json() return ...

0 answers

How DO i use SQLAlchemy to make sure that specific row values in mysql are not repeated

I have the following schema and i have only included columns that matter user_id , service_name ,kpi , isp , kpi_id 15 fibre internet speed blah1 1 15 Wimax internet ...

0 answers

Setting maxlag for ADF test with python statsmodels not working?

I've tried setting the maxlag with the ADF test in statsmodels but the number of lags being used by the test is not what I set it as. It is almost always less. Here's a small example of what I mean. ...

1 answer

Dynamic programming for primitive calculator

I'm dealing with the problem, that is pretty similar to change coins problem. I need to implement a simple calculator, that can perform the following three operations with the current number x: ...

0 answers

is it possible to manually restart celery task

I am using celery 3 with django and flower to monitor tasks. is there any way that if my task fail then i do some fix in code Then i get the task id and then rstart that task Is it possible

0 answers

python portable matplotlib.gif no such file or directory

So, I have Python Portable on my USB (every option installed, including Matplotlib), and whenever I try to run a script with a Matplotlib code, I get this: TclError: couldn't open ...

1 answer

Microsoft Face API complaining about bad Key, but Key working in console?

I been trying to solve this error but I can't find what seems to be wrong. I am using Microsoft Cognitive Services Face API with python. Here is my code: import requests import json import ...

1 answer

Checking condition for each line in CSV

Say I have a sample csv file like this: phonemes,graphemes W IY K D EY,w ee k d ay T EH K S T,t e x _ t Y UW,ewe _ SH UW T,chu te SH UW T,chu te SH UW T,chu te ! SX AH K,s u ck I want to check a ...

1 answers | 10 mins ago by Harry Lens on Stack Overflow
1 answer

Python Sum individual integers

I want to make a python app that sums the numbers of a birthdate. day = raw_input("What day were you born?") month = raw_input("What month were you born?") year = raw_input("What year were you ...

1 answers | 11 mins ago by Nicolas Moran on Stack Overflow
0 answers

Python Generic Looping Function to loop over expressions

Here is my problem I have a score card data and student marks. I want to score student marks based on the score card data (for a given subject) and append each subject score to the student marks ...

1 answer

Indexing numpy array not working

I am writing a function in which I want to store a 2 dimensional matrix as a subset of a larger 2 dimension matrix. All the code seems to be working correctly except that the result from einsum is not ...

2 answers

Interpreting Python code for partial derivatives of multi-variable function

I'm trying to understand how the following code works to numerically approximate the partial derivative of a function of multiple variables. To quote the book: When f is a function of many ...

2 answers | 17 mins ago by Hunter on Stack Overflow
1 answer

Error when opening xml file in python 3 with sublime text 3

Traceback (most recent call last): File "C:\Users\diamo\Documents\Sublime Text Saves\", line 50, in <module> stuff = ET.parse(fname) File ...

2 answers

How to recursively list files in AWS S3 bucket using AWS SDK for Python?

I am trying to replicate the AWS CLI ls command to recursively list files in an AWS S3 bucket. For example, I would use the following command to recursively list all of the files in the "location2" ...

2 answers

how to split column of tuples in pandas dataframe?

I have a pandas dataframe (this is only a little piece) >>> d1 y norm test y norm train len(y_train) len(y_test) \ 0 64.904368 116.151232 1645 549 1 ...

1 answer

Why the import of google.protobuf works fine in ipython but not in python?

In ipython Python 2.7.11 |Anaconda 2.4.1 (64-bit) IPython 3.1.0 -- An enhanced Interactive Python. In [1]: import google.protobuf In [2]: However in python: Python 2.7.11 |Anaconda 2.4.1 ...

0 answers

I want to use rfind() to find the highest index in a str but it returns lowest index

So I am working through a script in Python that opens a file containing email headers that I am parsing to find() a particular set of floating point numbers that I want to use to perform some math ...

0 answers

Restrict To Return None Value from the SQL Query

I am working With Odoo ERP and I want to restrict for return None Value from the List of Dictionary from the generate SQL Query. form_data =, uid, ids, ['start_date','end_date'], ...

2 answers

Editing Jekyll index.html

I'm trying to change my github pages Jekyll index.html --- layout: default --- {% for post in site.posts %} {{ post.title }} {{ post.excerpt }} Read More {% endfor %} to --- layout: default --- ...

0 answers

How can i use celery with different code base in API and workers

Currenty I have one Ec2 Instance for incomming API requests User orders goes to queue in redis via celery task I have 2 Ec2 instances processing queues The problem is the code base is same on ...

3 answers

Python : How to dynamically combine any number of small matrices into one big matrix

I have these 4 matrices and I want to dynamically combine them into one big matrix by passing n: number of small matrix and output matrix row and column example: [[[ 1 2 ] [ 3 4 ]] [[ 5 6 ] [ 7 ...

3 answers | 37 mins ago by Tevfik Xung on Stack Overflow
0 answers

createResolver() in twisted not working

I have a simple proxy script where I use installResolver function to choose where the script reads its hosts file: from twisted.internet import reactor from twisted.web import proxy, server from ...

1 answer

python 2.7 difficulty with files

I am attempted to create a program that counts the amount of animals (bear, wolf, etc) and put them into variables. This is not working import os def count_species(): sal_count = 0 ...

1 answers | 39 mins ago by millahgn on Stack Overflow
3 answers

How can I make setuptools install a package that's not on PyPI?

I've just started working with setuptools and virtualenv. My package requires the latest python-gearman that is only available from GitHub. The python-gearman version that's on PyPI is an old one. The ...

1 answer

beautifulsoup error while trying to get information from google news page: enthought canopy

I have below code from the page. It works very well and prints page content. But when I change r to a google news page (commented elow), I get an error(IOError ...

0 answers

Find elements by text with Beautifulsoup

I'm just learning Python and I've spent hours try to figure this one thing out. Basically, I have html doc with a repetitive structure and I am trying to pull out certain elements from each ...

2 answers

How to find the average of last 52 weeks sales at each time in python

I have a csv file with four columns: date, wholesaler, product, and sales. I am looking for finding average of last 52 weeks sales for each Product and Wholesaler combination at each date. It means ...

2 answers | 50 mins ago by Ashkan on Stack Overflow
0 answers

Building formatted report from tree data

All, I have a very large dataset that is structured as a tree of elements, e.g.: Person 0 |-Person 1 | |-Person 2 | |-Person 3 | |-Person 4 | |-Person 5 ... I want to build an HTML report that ...

0 answers

SciPy signal.tukey Module Error

I am getting an error when I run the code below in Pycharm. When I run the same code in terminal, it works fine! Anyone know what's going on? Is this a bug? from scipy import signal window = ...

15 30 50 per page
1 2 3