Interesting Tags
   11 tags on

1 answer

Picking a given arm within a class

I am trying to understand the UCB Bandit that is written about in this book, and I'm running into a bit of trouble accessing a given arm of a multiarm bandit. To put it in simpler terms: I have a ...

1 answers | 1 min ago by KingOliver on Stack Overflow
1 answer

Python - numpy.delete doesn't work

I'm trying to delete a line from a .xyz file through numpy.delete () command, but is not working. below is a part of the code problem. The code works without giving any error but the line is not ...

1 answers | 2 mins ago by Daniel Caye on Stack Overflow
0 answers

Problems to use layout grid() and pack() in Tkinter Python

I do not understand how to use the grid() function and the pack() in Python Tkinter. I've seen a tutorial but I can not sort the items I want. I'm using the pack function, but I don't know if grid ...

2 answers

How do you “echo” quotes using python's os.system()?

I'm trying to write to a monit config file using standard bash scripting inside if python's os.system(), this string is what I'd like to mimic. echo -e "\t" start program = \""/etc/init.d/snortd00 ...

4 answers

What does “|” sign mean in a Django template?

I often see something like that:|escape something is an object, property is it's string property. escape - i don't know :) What does this mean? And what min python version it is ...

0 answers

Plotting column average of a 2 dimensional array in matplotlib

SOLVED: Simple problem that I should really have seen a long time before posting this question. The code worked but I missed an additional line that added the extra plots. I am still new to coding so ...

0 answers

Drupal + CiviCRM: Contact form, add node/entityreference field

Is it possible somehow to put a node reference field on a CiviCRM contact form? Of course if it is solved for Entities, we have it for nodes. I only saw solution for the opposite way with ...

0 answers

Elements of a numpy array divided by an integer error

This is part of a bigger exercise in python using numpy. The ClassCMatrix is 5000 by 800. arrayofsums = np.sum(ClassCMatrix, axis=0) #len of this will be 800 for x in arrayofsums: ...

0 answers

Pandas read in table without headers

How can I read in a .csv file (with no headers) and when I only want a subset of the columns (say 4th and 7th out of a total of 20 columns), using pandas? I cannot seem to be able to do usecols

0 answers

Copy Excel Fromul in Python

I have a large spreadsheet that I am processing in python. The source sheet has embeded excel formulas. I am using the libraries xlrd and xlwt. The formatting (such as hightlight) is copied from the ...

0 answers

How to add Search Functionality to a website

We are currently building a Django web application for a client. We need a simple and smart way to offer a search feature on the website. There are several ways to do this in Django, but we haven't ...

0 answers

json.loads not replacing apostrophe

I have a json object that I am loading and replacing single with double quotes as I do. The syntax for this is: response = json.loads(response.text.replace("'", '"')) Within my data I have ...

0 answers

Easy way to add a number as an image in a matrix?

I'm creating a checkerboard pattern as follows: def CheckeredBoard( x=10 , y=10 , sq=2 , xmax = None , ymax = None ): coords = np.ogrid[0:x , 0:y] idx = (coords[0] // sq + coords[1] // sq) % ...

2 answers

Efficiently buid a python set from a list of unique elements

I have a list of elements which should be unique by construction. I mean, no element will be present more than once in the list. I want to efficiently test if an item is present in that list, and ...

1 answer

Background tasks and queue with django

I built an infinite drawing app (similar to webcanvas) with django. I made another small python app able to render areas of the canvas with cefpython. My goal is to have background tasks on my ...

1 answer

Can't Write a Node Structure with Python's ctypes library

I'm trying to write a standard node structure using ctypes, but it seems I can't reference the node itself, i.e.: import ctypes class A_Star_Node(ctypes.Structure): _fields_ = [("g", ...

1 answers | 13 mins ago by C. Porto on Stack Overflow
1 answer

Removing Paragraph From Cell In Python-Docx

I am attempting to create a table with a two row header that uses a simple template format for all of the styling. The two row header is required because I have headers that are the same under two ...

1 answers | 13 mins ago by carruthd on Stack Overflow
0 answers

Key Error on python & App Engine

I am developing an application on App Engine and Python. This app is meant to create routes to several points in town. To create this routes, I invoke a request to an Arcgis service. Once that is ...

6 answers

how to iterate through the list, fetching each possible pair of values?

How can I walk through the list (of numbers) and fetch every possible pair of its values? Example (java): for(int i = 0; i < 5; i++) for(int j = i+1; j < 5; j++) print(i, j); // ...

1 answer

Python Countdown Timer includes Extra Zero

So im attempting to make a timer that, once inputing any amount of minutes, the window will count down the time in a mm:ss format. however, when inputing a time over 10 mins, when the minutes get ...

1 answers | 15 mins ago by bladexeon on Stack Overflow
2 answers

Drawing 3D points on a 2D plot reading values from a file

I have a file containing sets of points with 3 coordinates, separated by tabs. Like this (spaces added for readability, not present in the original file): x0 \t y0 \t z0 x0 \t y1 \t z1 x1 \t y0 \t z0 ...

2 answers | 20 mins ago by Agostino on Stack Overflow
2 answers

How to get the number of requests in queue in scrapy?

I am using scrapy to crawl some websites. How to get the number of requests in the queue? I have looked at the scrapy source code and find scrapy.core.scheduler.Scheduler may lead to my answer. See: ...

2 answers | 20 mins ago by Shuai Zhang on Stack Overflow
1 answer

How to create a virtualenv with Python3 while my system is OsX 10 with Python2

My machine is OsX 10.10.2 and I have Python 2 installed. It is possible to create a virtualenv using virtualenvwrapper command mkvirtualenv to run on Python 3? I am reluctant to install Python3 in my ...

4 answers

python exponential function - incorrect exponential values

I have a range of negative values : -30 to -80 Let's say array_values = [-30, -31, -32, -33, -34, -35, -36, -37, -38, -39, -40, -41, -42, -43, -44, -45, -46, -47, -48, -49, -50, -51, -52, -53, -54, ...

4 answers | 21 mins ago by Raaj on Stack Overflow
2 answers

How to get links from “Inspect element” on page in python?

I need to get the video link from a web page. I click on inspect element and go to Network tab, and I see a link I need to get... But how can I access this link trough python? this is the situation: ...

2 answers

why won't getattr work for built in attributes?

The following code should print "person is true" and "plant is true", but it only prints the first one. I've tested it, and for some reason my code only works for attributes that are set after the ...

2 answers | 22 mins ago by user3150635 on Stack Overflow
1 answer

How to assign each word in a list to a variable, and then loop over them?

I have this object: M = TextBlob(data) Where data represents a sentence, and the words in the sentence are stored in M.words: >>> M.words ["Hello", "I", "am"] I then want to export each ...

0 answers

How to read branches in pyroot and make plots?

I'm completely new to Python and pyroot, and I want to write a small script in pyroot as a just practice. My root file has a subdirectory in which you can find a few trees some of which contains a few ...

2 answers

can't insert into the database with default parameter

I've created the following table CREATE TABLE mytable (database_id SERIAL PRIMARY KEY,contentCHAR(150)); But i can't manage to insert a row with the default option, so that database_id will ...

2 answers | 24 mins ago by Trux on Stack Overflow
2 answers

Validate an argument over another

I have two additional options and I need to validate the second taking into account first. I tried this: #!/bin/env python3 # -*- coding: utf-8 -*- from argparse import ArgumentParser, ...

2 answers | 24 mins ago by Mauricio on Stack Overflow
15 30 50 per page
1 2 3