Tagged Questions
Python is a dynamic and strongly typed programming language designed to emphasize usability. Two similar but mostly incompatible versions of Python are in widespread use (2 and 3). If you have a version-specific Python question consider using the [python-2.7] or [python-3.x] tags in addition to the [...
0
votes
0answers
10 views
How to print a python list, minus a specific element?
Given:
commands = dict(
onboarding = dict(
default = "default",
status = "APPROVED",
date = "11/18/15"
)
team = dict(
members = getTeamMembers()
)
How do I
print ...
0
votes
0answers
3 views
Recurring Custom Color Palette for Seaborn/Python/Matplotlib
I am looking to see if there is a way to set up a color palette to make sure that any time I graph, the colors of the bars will be consistent with the values on the x axis.
I am using Seaborn
I'm ...
-2
votes
0answers
25 views
Why isn't my function running?
I'm trying to write code that deals a set amount of cards to a set amount of players, but when I call the function I get an error saying the function is not defined. I haven't found any answers online ...
0
votes
0answers
5 views
Nonlinear optimization with multidimensional data
Problem
I am trying to fit a model with four parameters by training with a known data (time series). The main equation of the model is shown below, and two parameters that I am interested in finding ...
0
votes
0answers
5 views
Input box with drop down menu in Selenium and Python
I am trying to use Selenium, python, and firefox to enter data into an input box on a website and select from a dropdown menu in the text box, but have been unable to do so. Formerly it was "just" a ...
-4
votes
0answers
27 views
AttributeError: 'str' object has no attribute 'includes' [duplicate]
print("hello world")
myname = raw_input("what is your name")
print "hello",myname,"!"
mood = raw_input("how are you")
print ("good to hear")
if mood.includes("?"):
print ("im doing great")
im ...
0
votes
1answer
11 views
Windows - Python, check if program is open and if it is, open it from taskbar?
I have a program that uses PyAutoGui to open up Google Chrome and go to the website I want it to, however it opens up a new Chrome every time, is there a way I could make it check if it is open and if ...
-5
votes
0answers
25 views
Python Project tHelp
So I have the following project problem presented:
For this program, you are to help US Department of Homeland Security determine potential unwanted individuals at the next United Nations conference ...
0
votes
0answers
8 views
requests.post ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:598)
I'm trying to implement publication metadata depositing by posting an xml file to the registration agency's server.
I'm using requests as follows:
>>> r = requests.post(url, params=params, ...
2
votes
1answer
31 views
Feeding all combinations of x and y array into function f(x,y).
New to python and trying to teach myself the language. I understand the basics from R and SAS however I am still learning how to manipulate arrays and learn basic python in spyder.
I would really ...
0
votes
0answers
6 views
Exception: Output tensors to a Model must be Keras tensors
I get this exception running the following code:
base_model = VGG16(weights='imagenet')
conv4_3, conv3_3, conv2_2, conv1_2 = base_model.get_layer('block4_conv3').output, base_model.get_layer('...
1
vote
1answer
10 views
can't analyze output from txt file python - ValueError: I/O operation on closed file
I am trying to learn simple text analysis using Twitter data. Ultimately I want to search for tweets with certain strings, and may analyze the favorite count for them. But right now I am trying to do ...
-2
votes
0answers
5 views
Project Flow for a windows application
I want a little guidance about how to start a Windows software.
I want to start with a team a project about eyetracking.
What about using this library? PyGaze
And one more thing. Is it possible to ...
0
votes
0answers
4 views
Gtk3 Python - permanently visible SearchBar
I am trying to have a small application with a permanently visible searchbar. The current implementation of Gtk.SearchEntry is that the searchbar disappears from the window when you press Esc. I have ...
1
vote
4answers
30 views
zip function is returning duplicates
Currently my list is:
[[(881, 886), ('Twilight Sparkle', 'Rainbow Dash')],
[(883, 885), ('Applejack', 'Rarity')],
[(887, 884), ('Princess Celestia', 'Pinkie Pie')],
[(888, 882), ('Princess Luna',...
0
votes
1answer
25 views
Compare non identical objects with same value
I have 2 lists,both in different formats but same content.
For example, doing a simple print command for the 1st elements of the list does the following:
prefix_txt[0]=SEF00
prefix_confluence[0]=[u'...
-2
votes
0answers
9 views
Popularity recommander using python
i need to find out which items are the most popular items based on the reviews.
I used to use graphlab. but its not free. Do anybody know how to build a popularity recommender using python open source ...
-1
votes
1answer
33 views
Search a string for a given key
I've been doing some more CodeEval challenges and came across one on the hard tab.
You are given two strings. Determine if the second string is a substring of the first (Do NOT use any substr type ...
-1
votes
0answers
21 views
how can I make a window with a button
I have searched a lot to find a way to make a window which has a bottom and if I click on it, I can load any file such as txt, xls etc by that.
I have found this which works fine but I want to link ...
0
votes
2answers
10 views
npm install bcrypt, gyp ERR! python
on windows 10 node:v6.7.0, npm:v4.0.1 node-gyp:v3.4.0, I am trying to npm install --save bcrypt that I face these errors. this is where I have both, python27 and python35-32 in my path.
D:\myApp\...
0
votes
2answers
9 views
How to batch inputs together for tensorflow?
I'm trying to batch together the inputs for a neural network I'm working on so I can feed them into tensorflow like in the tensorflow MNIST tutorial. However I can't find anyway of doing this and it ...
1
vote
0answers
5 views
using fira sans font in python matplotlib
I've downloaded the fira sans font and installed it systemwide on a debian jessie linux system.
$ sudo mkdir -p /usr/share/fonts/truetype/FiraSans
$ sudo mkdir -p /usr/share/fonts/opentype/FiraSans
$ ...
0
votes
1answer
11 views
Pars Script to find special value with Beautifuo soup
I have this script:
var s1 = new SWFObject('/media/player/flvplayer.swf','single','400','300','7');s1.addParam('allowfullscreen','true');s1.addVariable('file','http://cdn.abc.con/video.flv');s1....
-2
votes
0answers
35 views
Combine three dictionaries using values Python
Problem working with dictionaries.
Let me comment my problem.
I have three tables and need to create a fourth groping all information.
File 1: contains the keys of interest that I want to complete ...
0
votes
1answer
23 views
Python argparse with — as the value
Is there a way to pass -- as a value to a Python program using argparse without using the equals (=) sign?
The command line arguments that I added to the argparser are defined like below:
parser....
1
vote
3answers
26 views
how can I make my Python string match non-greedily?
Given a text file that looks like so:
Samsung Galaxy S6 active SM-G890A 32GB Camo White (AT&T) *AS-IS* Cracked Screen
Samsung Galaxy S6 SM-G920 - 32GB - White Verizon Cracked screen
Samsung ...
1
vote
0answers
20 views
Global name not defined when function calls a function
I am able to run a script but when I attempt to call functions in it (that call functions in other files) from another module, I get a global name not defined error.
>>> reachable('192.168....
1
vote
0answers
6 views
execute command in Windows VM using pyvmomi
I'm using vSphere and I want to execute commands remotely using Pyvmomi. I found a sample which is execute_program_in_vm.py but unfortunately it's only working for debian/ubuntu.
Is there anyway to ...
1
vote
1answer
26 views
Unable to run script because of the 'å's presence in my script
Here is the line that causes the error:
emner = browser.find_element_by_link_text('Armbåndsure og lommeure')
And the output:
File "test.py", line 96
SyntaxError: Non-UTF-8 code starting with '\...
0
votes
0answers
9 views
What is the type returned by quandl.get?
I'm currently following tutorial in which you get data form quandl. I know the basics of python, but I can't figure out what is the type returned by quandl.get. I have searched for it, but everything ...
-3
votes
2answers
28 views
How do I multiply one list by another in every possible combination?
For example:
list1 = [1, 2, 3]
list2 = [4, 5, 6]
Wanted result:
NewList = [4, 5, 6, 8, 10, 12, 12, 15, 18]
1
vote
0answers
6 views
Python - multiprocessing.pool.MaybeEncodingError while downloading images
I have been trying to download images from Flickr. I first scrape all the URL's from Flickr and then I feed the URL list to a function that downloads the images in those URL's for me.
def ...
0
votes
2answers
10 views
Tensorflow. Converting unknown dimension size of a tensor to int
Assume we have
a = tf.placeholder(tf.float32, shape=(None, 3072))
b = a.get_shape()[0]
How can I convert b such that I can use it in further calculations, e.g. for given tensor T I will be able to ...
0
votes
0answers
13 views
Django Queryset compare two different models with multiple rows
I have these two models that I would like to return the sum of. I get an database error about the subquery returning more than one row. What would be the best way to compare both without using a for ...
7
votes
3answers
64 views
Why do Python yield statements form a closure?
I have two functions that return a list of functions. The functions take in a number x and add i to it. i is an integer increasing from 0-9.
def test_without_closure():
return [lambda x: x+i for ...
0
votes
1answer
51 views
Parsing text file into csv
I have a following sample data(it's just a portion)from my text file. I am trying to extract three keys including timestamp,dataFrame, and rssi into csv file.
packet"{\"test\":{\"id\":1479238177559,\"...
-1
votes
0answers
7 views
Opencv detect Numbers from 1 to 20 in a image
i have real time environment and that contain numbers how to detect numbers the problem is only that to find number from image.i converted the image into hsv after i am stuck.
-2
votes
0answers
29 views
Print result of a function in python 3.5 [on hold]
I have the following code:
import subprocess
def list_pods():
run = 'ls -l'
command = subprocess.check_output(run.split(' '))
return command
print (list_pods)
Usually in python 2.x ...
0
votes
0answers
10 views
Problems with using django-crontab in Heroku (Django project)
it is impossible for me to run cron jobs using django-crontab in heroku. Cron job seems to run fine for me locally but failed in heroku server. Following this tutorial and it works fine without heroku ...
0
votes
0answers
13 views
Persisting state when implementing MinHeap with heapq
I'm trying to implement a StreamingMedian object to maintain the median through successive calls of get_median(). To do so, I've also implemented a MinHeap and MaxHeap class via the heapq module.
I'...
0
votes
0answers
17 views
How to Perform Distance versus Angle Signature in Python?
I'm working on image representation using distance versus angle signature. There is no problem when I compute the object reference signature. But when I compare it with same object which was rotated ...
0
votes
0answers
5 views
django django-allauth save extra_data from social login in signal
Setup
I'm using Django 1.8.15 and django-allauth 0.28.0
Description
What I want to do is pretty easy to explain:
If a user logs in via social media (facebook, google+ or twitter) i want to retrieve ...
0
votes
1answer
20 views
Why can't I update pip on Windows 7?
I downloaded pip from the pip website and ran it on Python IDLE
3.4. When I did that, it says
You are using pip version 6.0.8, however version 9.0.1 is available.
So I tried to upgrade it on ...
0
votes
0answers
16 views
What does the server receive when a client connects with HTTP protocol?
As far as I understand if I connect to a server using the HTTP protocol the server itself receives only the application layer (and the computer deals with the other layers containing the protocol, ip ...
-2
votes
2answers
59 views
Better way of computing probabilities?
All right. The assignment I'm working on is making a game fair by changing the payout for winning the game.
To verify that the game is now more fair, I have several instances of the same code in the ...
0
votes
0answers
15 views
Django - How can I debug code which POST's when a bug seems to be in the view?
I thought I would ask a broad question so I get a better understanding of Django and can more readily deal with any similar problems I may encounter. The specific issue which I am having is that I ...
2
votes
1answer
16 views
Why do Tkinter's Radio Buttons all Start Selected When Using StringVar but not IntVar?
Here is some example code that creates 4 radio buttons, 2 using int and 2 using str :
from tkinter import *
class test:
def __init__(self):
wind = Tk()
frame1 = Frame(wind)
...
0
votes
0answers
13 views
Python/sklearn - preprocessing.MinMaxScaler 1d deprecation
I'd like to scale a column of a dataframe to have values between 0 and 1. For this I'm using a MinMaxScaler, which works fine, but is sending me mixed messages. I'm doing:
x = df['Activity'].values #...
0
votes
0answers
12 views
ImportError: No module named tablecheck.wsgi when starting up django/uwsgi app
I am trying start up an django app that someone else wrote. I get:
ImportError: No module named tablecheck.wsgi
The file that calls this looks like this:
cat checkplease.ini
# this file was ...
0
votes
2answers
34 views
Python regex not working with unicode
I'm trying to get rid of everything from a string excluding lowercase alphanumerics and whitespace.
The problem is when I use a unicode character like this:
re.sub(r'[^a-å_\s]', '', '¤☃')
It doesn'...