text stringlengths 226 34.5k |
|---|
Maintaining 'focus' on Leap Motion Python (IDLE) code execution
Question: When executing Leap-Motion-centric code in the Python IDLE, switching to
another window makes the IDLE disregard the Leap controller and stop
processing `frame`s. How can this be avoided so that, say, the Leap gestures
can be used to interact wit... |
Python threading.thread.start() doesn't return control to main thread
Question: I'm trying to a program that executes a piece of code in such a way that the
user can stop its execution at any time without stopping the main program. I
thought I could do this using threading.Thread, but then I ran the following
code in I... |
MapReduce: How to keep track of states across multiple lines in the mapper (say for counting trigrams)?
Question: I'm trying to write a MapReduce program for computing
[Trigrams](http://en.wikipedia.org/wiki/Trigram) using the mrjob framework in
Python. So far, this is what I have:
from mrjob.job import ... |
Drawing rectangle or line using mouse events in open cv using python
Question: I am trying to draw a straight line between two coordinates which would be
obtained by clicking on the image or by mouse events. I am able to draw
individual circles on clicking the mouse, but cannot figure out how to draw
line between those... |
Error running Django project in virtualenv
Question: I have a django project which works fine without virtualenv. But now I'm
putting it in a virtualenv and it doesn't run. Without virtualenv:
python manage.py runserver --settings=Janta.settings.local
This works fine. With virtualenv when I do the ... |
Accessing Flask server from my web page
Question: This is a question continue from this question
[here](http://stackoverflow.com/questions/22088719/can-flask-use-with-jquery-
post).
I am trying to control a servo motor using the image buttons on my web page.
My servo controller is in the form of python script (cameras... |
Send multiple emails in the same thread using python and gmail
Question: I have a program running. When that program gets a result, it sends me an
email using this function:
def send_email(message):
import smtplib
gmail_user = OMITTED
gmail_pwd = OMITTED
FROM = O... |
How to know where an object was instantiated in python?
Question: I define a class in a given python module. From a few other python files I
will create instances of said class. The instances register themselves at
object creation, ie during `__init__()`, in a singleton registry object. From
a third type of python file... |
Compare node value from xml with String in Python
Question: After searching a lot and trying a lot I am not able to compare the node from
xml with string entered from User in python script. I hope it is due to a type
mismatch because I am getting value from XML in unicode format, please suggest
the way ASAP to compare ... |
tweepy verifier runtime error
Question: I am trying to run a simple app using twitter API wraper called tweepy (with
Python), and I can't get past the verifier step.
My code is really simple.
from flask import Flask
from flask import request
import flask
import tweepy
session=dict(... |
image saving in python (matplotlib)
Question: In the code that I am working on, I have the following line:
import pylab as pl
pl.imsave(out_dir+'/'+fname.split('/')[-1],masked_im,vmin = 0, vmax = 1,cmap = 'gray')
However, I keep on getting the error that Bbox.from_bounds takes four
argu... |
Is there a way to sort a list in python until the first sorted k elements are found?
Question: I have a normal boring list of non sorted numbers. From that list I need to
take the first k elements after sorting. The thing is that if the list is
considerably long and k is considerably small sorting the entire list seems... |
Python - Calculate histogram of image
Question: I'm working on teaching myself the basics of computerized image processing,
and I am teaching myself Python at the same time.
Given an image `x` of dimensions 2048x1354 with 3 channels, efficiently
calculate the histogram of the pixel intensities.
import n... |
Python lists not working properly
Question:
import random
words = ["Football" , "Happy" ,"Sad", "Love", "Human"]
for word in words:
word = random.choice(words)
print(word)
words.remove(word)
Why does the above code only print out 3 words instead of all 5? Am I trying... |
python counting and appending to list
Question: I'm trying to count how times something occurs in a list. Is it possible to
set a variable to move through each index and count it. I want to append how
many times each one is counter to a list.
I want it to look like this. Forget the while loop, it's just to show that ... |
palindromic numbers in python
Question: Trying to find the largest palindrome that's the product of two three-digit
numbers. Before I look up the infinitely more efficient and - more importantly
- working solution, could you tell me what's wrong with my code? I just keep
getting the empty set.
def palind... |
OpenShift mysql connection issues in python
Question: I previously wrote my app using local development servers, and now that I have
moved it onto an openshift small gear almost all works except for mysql
connections.
In my code I have the line:
self.db = MySQLdb.connect(host, username, password, dbname... |
How to enable textsearch in mongodb using python?
Question: I have written `textSearchedEnabled=true` in the following script but a syntax
error occurs. I can not understand how to enable the text search in mongo db
using python.
import json
import pymongo # pip install pymongo
from bson impor... |
python: input is not matching
Question:
import os
import fileinput
filenames1=os.listdir("./chi_square_metal_region_1")
filenames1.sort()
for line in fileinput.input("./test_input.dat"):
for eachfile in filenames1:
if eachfile == line:
print yes
... |
Python redmine: wiki page text
Question: I use [python-redmine](https://github.com/maxtepkeev/python-redmine/) and want
to get wiki page text, but get error - attribute isn't exists (but text
exists), here is my code:
from redmine import Redmine
redmine = Redmine('http://redmine.example.com', us... |
Error while creating an object of an other class in a class of type Thread in Python
Question: Level: Beginner
I am using python v2.7 and wxPython v3.0 on windows 7 32-bit.
**My app** : I have 3 classes. One class is `gui(wx.Frame)` and other is
`TestThread(Thread)` and the third is `labels()`.
**Problem** : I am tr... |
Modules for correlate2d in Python
Question: I want to calculate the correlation between two matrices using
[`correlate2d`](http://docs.scipy.org/doc/scipy-0.7.x/reference/generated/scipy.stsci.convolve.correlate2d.html)
(code: `corr = correlate2d(im, im, fft = True)`).
`correlate2d` was part of scipy and is now under
... |
ImportError: No module named pkg_resources after I upgrade python from 2.6.6 to 2.7.3
Question: When I run `pip install xxx` or `easy_install xxx`, I met this problem after
upgrading Python from 2.6.6 to 2.7.3:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_r... |
Celery Beat Windows Simple Example (not with Django)
Question: I'm really struggling to set up a periodic task using Celery Beat on Windows 7
(unfortunately that is what I'm dealing with at the moment). The app that will
be using celery is written with CherryPy, so the Django libraries are not
relevant here. All I'm lo... |
Python2 sax parser, best speed and performance for large files?
Question: So Ive been using suds with great benefit to consume a webservice.
Hit an issue with performance, for some data the cpu would spike hard, it
would take more than 60s to complete the request, which is served by gunicorn,
suds to webservice and so... |
Uploading video to YouTube and adding it to playlist using YouTube Data API v3 in Python
Question: I wrote a script to upload a video to YouTube using YouTube Data API v3 in the
python with help of example given in [Example
code](https://developers.google.com/youtube/v3/guides/uploading_a_video).
And I wrote another s... |
Embedding Python 3.3 in C++ from zipped standard library on Windows XP
Question: I want to embed Python 3.3.4 in my C++ application so that:
* Python's standard library is always taken from a zip archive alongside my app's executable (shouldn't depend on any environment vars etc);
* my own custom .py modules are i... |
fast read less structure ascii data file in numpy
Question: I would like to read a data grid (3D array of floats) from .xsf file. (format
documentation is here <http://www.xcrysden.org/doc/XSF.html> the
BEGIN_BLOCK_DATAGRID_3D block )
the problem is that data are in 5 columns and if the number of elements
Nx*Ny*Nz is ... |
Trying to Parse JSON date to POST to another System (Python)
Question: I am trying to write a script to GET project data from Insightly and post to
10000ft. Essentially, I want to take any newly created project in one system
and create that same instance in another system. Both have the concept of a
'Project'
I am ext... |
Concurrently run two functions that take parameters and return lists?
Question: I understand that two functions can run in parallel using `multiprocessing` or
`threading` modules, e.g. [Make 2 functions run at the same
time](http://stackoverflow.com/questions/2957116/make-2-functions-run-at-the-
same-time) and [Python ... |
Convert a list of sets to a set of sets (to find the unique elements)
Question: I want to find the unique elements in `A =[set([1,2]),set([1,2]), set([1])]`
in Python. I tried set(A); it didn't work. Is there any easy way to do it?
Answer: Convert your sets to [`frozenset()`
objects](http://docs.python.org/2/library/... |
Querying an Excel spreadsheet and returning results? But which program?
Question: A company I am working for has recently asked the head tech to compile a
spreadsheet that has every single computer name listed, along with the person
that uses that computer. The idea is that Help Desk can have this spreadsheet
open, so ... |
numpy correlation coefficient: np.dot(A, A.T) on large arrays causing seg fault
Question: NOTE:
Speed is not as important as getting a final result.
However, some speed up over worst case is required as well.
I have a large array A:
A.shape=(20000,265) # or possibly larger like ... |
python pandas read_csv how to parse microsecond
Question: I have csv file with microsecond as time.
Time,Bid
2014-03-03 23:30:30:224323224323,0.8925
2014-03-03 23:30:30:224390224390,0.892525
2014-03-03 23:30:30:224408224408,0.892525
2014-03-03 23:30:30:364299364299,0.8... |
scrapy and relative paths
Question: I am not straightforward with python, I have been trying for hours now to cut
off few char from multiple elements in a list. All scrapped links that I want
to follow with my spider are relative, here are just few lines of my output:
[u'../../../info/Auto/Dutch/']
... |
Scrapy - Non-ascii-character declared, but no encoding declared
Question: I'm attempting to scrape some basic data off this site as an exercise to learn
more about scrapy, and as proof of concept for a university project:
<http://steamdb.info/sales/>
When I was using the scrapy shell I was able to get the information ... |
How to set up Python packages
Question: I want this structure:
Zimp/controller/game_play -->How do I: import Zimp/model/game_play module in
the easiest way? Zimp/model/game_play
I made a folder called controller and a folder called model. Within those
folders I put an empty `__init__.py` file (don't know why that wou... |
Generating all permutations excluding cyclic rotations in Python
Question: I need to create a (practice) program for currency arbitrage that detects
profitable "loops" given a series of exchange rates. So there might be
different values for USD->JPY, JPY->USD, USD->EUR, and so on. In order to
detect profitability, howe... |
How can I find the MAC address of a client on the same network, using Python-Flask?
Question: I am looking for a python way grab the client's MAC address. All requests are
over the same network. I am looking for something similar to perform `arp -n
<Client_IP>` on the router.
Answer: Not sure but you can always get I... |
add text in bins of histogram in wxpython
Question: How to write text inside bins(bars) of histograms in wxpython?
import csv
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.figure import Figure
data1 = np.random.normal(5.0,... |
SocketServer ThreadingMixIn purpose of server_thread
Question: In the example of a asynchronous (threading) SocketServer
<http://docs.python.org/2/library/socketserver.html> a server thread (called
server_thread) is started, to start new threads for each request. Due to some
problems catching KeyboardInterrupts, I star... |
python mock: @wraps(f) problems
Question: I want to test a simple decorator I wrote:
It looks like this:
#utilities.py
import other_module
def decor(f):
@wraps(f)
def wrapper(*args, **kwds):
other_module.startdoingsomething()
try:
retur... |
Python code does not work, while counter does not work
Question: I am currently working on a project for class and we have come up with a
problem. When we run the code, it usually crashes. I am guessing it runs
infinitely. This program is also using Tkinter. Here is the code:
import tkinter as tk
... |
Encode MIME multipart with binary data in Python?
Question: How can I construct a MIME multipart message in Python? I've tried the `email`
package of Python but it appears broken -- it doesn't properly do binary
sections (sets their `Content-Transfer-Encoding` to base64 and leaves the data
as binary). Note it is very i... |
Python @properties raising an error
Question: I am trying to write a class to pass the following unittest:
import unittest
from property_address import *
class TestAddresses(unittest.TestCase):
def setUp(self):
self.home = Address( name='Steve Holden', street_addre... |
Debugging Heapsort in Python
Question: I know how to program in Java, I am very new to python. I am trying to
implement HeapSort in Python but I am unable to get where this code went
wrong. Can anyone help ?
This is my implementation:
class HeapSort:
def sort(self,list):
self.p ... |
Trouble parsing comments with praw
Question: I'm trying to scan a particular subreddit to see the how many times a comment
appears in the top submissions.
I haven't been able to get any indication that it is actually reading the
message, as it won't print the body of the message at all. _Note:_ sr =
subreddit phrase =... |
Split string into different labels
Question: I'm trying to split a string into words and then putting each word on a
different label. I found here a code that can split and print each word:
my_phrase="The split method returns a list of the words in the string"
my_split_words = my_phrase.split()
... |
Regex - how to capture many words
Question: I have a simple regex question:
Given a string like `"test-class"` what regex should I use to get
`['test','class']` (in python context)
Answer: You don't need a regex; just use
[`str.split()`](http://docs.python.org/2/library/stdtypes.html#str.split):
>>> '... |
join() threads without holding the main thread in python
Question: I have a code that calls to threads over a loop, something like this:
def SubmitData(data):
# creating the relevant command to execute
command = CreateCommand(data)
subprocess.call(command)
def Main():
... |
why are '(single quote) or "(double quote) not allowed in subprocess.check_output() in python?
Question: I am using subprocess.check_output() method to execute commands from within
the python script.
There are some commands that need "(double quotes) to be present in syntax.
Here's one example:
>drozer ... |
Use python mechanize to log into pages with NTLM authentication
Question: I want to use mechanize to log into a page and retrieve some information. But
however I try to authenticate It just fails with Error code **HTTP 401** , as
you can see below:
r = br.open('http://intra')
File "bui...e\_mechanize... |
Open shell in Python
Question: How can I open in Python a unix shell, type a command and some other inputs
and close the unix shell?
Example commands and inputs:
telnet 127.0.0.1:6000
user
pass
save-all
restart
Greets
miny
Answer: You can have a look at the `pexpect` module and ... |
Rewriting Java BigInteger function in python
Question: I'm trying to rewrite some javacode in a python script. One part of that is to
deduce a simple number from a sha256 hash.
in java this function is called:
public static Long getId(byte[] publicKey) {
byte[] publicKeyHash = Crypto.sha256().di... |
How do I optimize tens of thousands of substring searches in instance attributes in Python?
Question: I'm trying to write a program which autocompletes user input which may be one
of the following: an airport's three letter IATA code, a city's name, a city's
name in one of given languages, an airport's name, a country'... |
Python tkinter inserting string in texttbox out of a function
Question: Trying to add text from a function into a textfield, but can't figure out how.
Every time when the Start button is clicked it should add text to the
textfield.
import Tkinter
class GuiCreate:
def __init__(self,p... |
Limit which classes in a .py file are importable from elsewhere
Question: I have a python source file with a class defined in it, and a class from
another module imported into it. Essentially, this structure:
from parent import SuperClass
from other import ClassA
class ClassB(SuperClass):
... |
strip() and strip(string.whitespace) give different results despite documentation suggesting they should be the same
Question: I have a Unicode string with some non-breaking spaces at the beginning and
end. I get different results when using `strip()` vs.
`strip(string.whitespace)`.
>>> import string
... |
Removing newline characters not working
Question: Im trying to remove the `\n` from a list created in a function. My code for
removing it doesnt seem to be working. Im not getting an error either??
**CODE**
#!/usr/bin/python
"""
Description:
Basic Domain bruteforcer
Usage:... |
Python function invoked before definition
Question: I am confused about the below given code in Python where a function has been
called before its definition. Is it possible? Is it because the function does
not return a value?
from Circle import Circle
def main():
myCircle = Circle()
... |
Iterating through individual files in os.walk in Python in an idiomatic fashion
Question: I started with some code I got from [another stackoverflow
question](http://stackoverflow.com/questions/2865278/in-python-how-to-find-
all-the-files-under-a-directory-including-the-files-in-s/2865328#2865328) to
generate full path... |
python creating sqlite word dictionary
Question: I am trying to create a database of english words, But no values are being put
into the database ,
I am reading each word from a file and using it's sha256 hash to represent the
definition of the word, But when i execute the script the database stays the
same and is not... |
Navigating a website in python, scraping, and posting
Question: There are many good resources already on stackoverflow but I'm still having an
issue. I've visited these sources:
* [how to submit query to .aspx page in python](http://stackoverflow.com/questions/1480356/how-to-submit-query-to-aspx-page-in-python)
* ... |
Disappearing Axes, LogLog Plot Python
Question: I am running a loop to plot a bunch of different lines but it makes the most
sense to plot them on a loglog plot (dealing with about 9 orders of
magnitude). They plot how they should with a loglog plot but the axes/axes
labels are disappearing only when I try to log plot ... |
Validating URLs in Python
Question: I've been trying to figure out what the best way to validate a URL is
(specifically in Python) but haven't really been able to find an answer. It
seems like there isn't one known way to validate a URL, and it depends on what
URLs you think you may need to validate. As well, I found i... |
Trouble using mkvirtualenv after installing OS X Mavericks
Question: I recently installed OS X Mavericks. I can access my previously created
virtual environments, but I have trouble creating a new one:
Christophers-MacBook-Pro-2:~ christopherspears$ mkvirtualenv bottle_todo
-bash: /usr/local/bin/virt... |
Remote Sensors Protocol with C++
Question: I am working on a project with the raspberry Pi and Scratch. I need to use the
Remote Sensors Protocol with C++. I have tried porting the Python code across
but i cannot get C++ to return the null values.
The original Python code looks like this:
import socket
... |
Python: datetime64 issues with range
Question: I am trying to have a vector of seconds between two time intervals:
import numpy as np
import pandas as pd
date="2011-01-10"
start=np.datetime64(date+'T09:30:00')
end=np.datetime64(date+'T16:00:00')
range = pd.date_range(start, end, f... |
Least-Squares Fit to a Straight Line python code
Question: I have a scatter plot composed of X and Y coordinates. I want to use the
Least-Squares Fit to a Straight Line to obtain the line of best fit.
The Least-Squares Fit to a Straight Line refers to: If(x_1,y_1),....(x_n,y_n)
are measured pairs of data, then the bes... |
How to normalize a histogram in python? (updated)
Question: I'm trying to plot normed histogram, but instead of getting 1 as maximum value
on y axis, I'm getting different numbers.
For array k=(1,4,3,1)
import numpy as np
def plotGraph():
import matplotlib.pyplot as plt
... |
Execution of Python code with -m option or not
Question: The python interpreter has `-m` _module_ option that "Runs library module
_module_ as a script".
With this python code a.py:
if __name__ == "__main__":
print __package__
print __name__
I tested `python -m a` to get
... |
Use Python's bisect in C/Objective-C
Question: I'm looking to port this class written in Python
<http://stackoverflow.com/a/4113400/129202> into Objective-C, or C.
It uses something called `bisect.bisect_right`. I'm not terribly experienced
with Python, so how would one implement that in C/obj-c?
Answer: This is the... |
Import Java library in RIDE
Question: I'm trying to use a java library in RIDE. I found a good tutorial(
<https://blog.codecentric.de/en/2012/06/robot-framework-tutorial-writing-
keyword-libraries-in-java/>) I follow it, but when the time comes to import
and use the java library ( Database Library)in RIDE. It fails. Wh... |
Error handling with verbose output
Question: Im trying to implement the `--verbose` option in my script. The idea is to
turn on extra printing of errors etc for debugging, but for some reason it
doesnt seem to work. Ive tried a few variations of the `if verbose` statement
but no joy. Im hoping someone could point me in... |
What is islambda function in python
Question: Can anyone help me understanding this:
def isalambda(v):
return isinstance(v, type(lambda: None)) and v.__name__ == '<lambda>'
Answer: The function tests if a function object was created using a `lambda`
statement:
>>> l = lambda... |
Unable to import MySQLdb in ansible module
Question: I am trying to write custom module in ansible. while using `import MySQLdb` it
is giving me error
failed: [127.0.0.1] => {"failed": true, "parsed": false}
invalid output was: Traceback (most recent call last):
File "/root/.ansible/tmp/ansibl... |
using GPIO to control raspberry picamera with push button
Question:
import time
import os
import RPi.GPIO as GPIO
GPIO.setmode(GPIO.BCM)
GPIO.setup(23 , GPIO.IN)
while True:
if GPIO.input(23)==1:
os.system('raspistill -o image.jpg')
os.system(‘gpicview image.jpg &’... |
Python 2 tuple / list unpacking using star throws SyntaxError
Question: Why does the following code throw a `SyntaxError` for `*phones` in Python
2.7.3?
contact = ('name', 'email', 'phone1', 'phone2')
name, email, *phones = contact
Was this introduced in Python 3 and not backported? How can I g... |
Python (if, elif, else) working with timestamp
Question: I am taking a beginning Python programming class and I am having trouble
getting the code below to work correctly. The assignment asks: write a Python
code that uses the “strftime()” function to get the today’s weekday value and
then use an “if..elif..else” state... |
Django caching issue
Question: When I'm changing something in .py files, the changes are not shown
immediately, but after few minutes (even half hour). I'm restarting, reloading
apache, this don't help.
I'm using Apache2 with mod_wsgi on ubuntu server.
It doesn't even create .pyc files.
Here's my [settings.py](http... |
Make a script in python that lists adjacent words through Unix?
Question: How can I write a script in python through nested dictionaries that takes a
`txt` file written as,
white,black,green,purple,lavendar:1
red,black,white,silver:3
black,white,magenta,scarlet:4
and make it print... |
Hammerwatch Puzzle; Solving with Python
Question: So, my wife was playing Hammerwatch on Steam. She came across a puzzle I
decided I'd try to program a solution for.
Here's how the puzzle works:
Activating a switch either turns ON or OFF that switch, and toggles its
adjacent switches as well.
Here's a YouTube vid... |
Defining Views and URLs for Many to Many field in Django
Question: I'm new to Django and have been stuck on this for a few days now. Hoping to
find some help here. I've searched stackoverflow and read through the django
docs but haven't been able to grasp this. I'm using Django 1.6.2 and Python
2.7.
I'm setting up a s... |
is it possible to save generated wsdl stub classes to disk using SUDs in python
Question: I have a wsdl that takes a lot of time to get processed using SUDS.
client = Client(url)
Now is there a way i can save generated client classes from python to disk(i
tried using cPickle but it gives error as t... |
Error trying to call the backend module in pyusb. "AttributeError: 'module' object has no attribute 'backend'"
Question: I'm fairly new to this so please bare with me!
I recently installed pyusb for this project, which is trying to attempt at
writing to a [USB LED Message Board](https://www.thinkgeek.com/product/1690/... |
Writing multiple Python dictionaries to csv file
Question: Thanks to this other thread, I've successfully written my dictionary to a csv
as a beginner using Python: [Python: Writing a dictionary to a csv file with
one line for every 'key:
value'](http://stackoverflow.com/questions/8685809/python-writing-a-
dictionary-t... |
Solving 'Cookies must be enabled to use GitHub' using GAE/Webapp2/Urllib2/Python
Question: Despite looking through the API documentation, I couldn't find anything
explaining why Github needs cookies enabled, or how to go about it. I may have
missed it tho.
I'd like to use the native Webapp2 framework on GAE in Python ... |
./xx.py: line 1: import: command not found
Question: I am trying to use this [Python urllib2 Basic Auth
Problem](http://stackoverflow.com/questions/2407126/python-urllib2-basic-auth-
problem) bit of code to download a webpage content from an URL which requires
authentication. The code I am trying is:
im... |
Find the nth lucky number generated by a sieve in Python
Question: I'm trying to make a program in Python which will generate the nth lucky
number according to the [lucky number
sieve](http://en.wikipedia.org/wiki/Lucky_number). I'm fairly new to Python so
I don't know how to do all that much yet. So far I've figured o... |
Why does my WSGI app always get URL decoded path in environ['PATH_INFO']?
Question: I have a simple bare WSGI application:
def application(environ, start_response):
start_response('200 OK', [('Content-Type','text/html')])
print('PATH_INFO:', environ['PATH_INFO'])
return [b'<p>Hell... |
Set callback along with its parameters and invoke the callback later
Question: I have a simple class `Foo` that allows the user of this class to set a
callback and later run it three times.
This is how I am solving the problem.
# API code
class Foo:
def set_handler(self, callback, *args, **k... |
FileNotFoundError: [Errno 2] No such file or directory
Question: I am trying to open a CSV file but for some reason python cannot locate it.
Here is my code (it's just a simple code but I cannot solve the problem):
import csv
with open('address.csv','r') as f:
reader = csv.reader(f)
... |
NO video file was saved by using Python and OpenCV on my Raspberry PI
Question: I have two pieces of codes. Here is the first one. It was mainly copied from
[save a video section](http://opencv-python-
tutroals.readthedocs.org/en/latest/py_tutorials/py_gui/py_video_display/py_video_display.html#display-
video) on OpenC... |
PyEval_GetLocals returns globals?
Question: I am trying to access the python locals from the constructor of a C++ class
exported with boost.python, but PyEval_GetLocals() seems to return the global
instead of local dict. An example: in C++ I do
class X {
public:
X() {
boost:... |
Is it possible to use cut on a collection of datetimes?
Question: Is it possible to use `pandas.cut` to make bins out of `datetime` stamps?
The following code:
import pandas as pd
import StringIO
contenttext = """Time,Bid
2014-03-05 21:56:05:924300,1.37275
2014-03-05 21:56:05:924351... |
Trying to run GAE python - not sure if imports and app.yaml is configured correctly
Question: I'm trying to deploy the following python code named image-getter.py in GAE:
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext import os
from googl... |
Passing numpy string-format arrays to fortran using f2py
Question: My aim is to print the 2nd string from a python numpy array in fortran, but I
only ever get the first character printed, and it's not necessarily the right
string either.
**Can anyone tell me what the correct way to pass full string arrays to
fortran?*... |
What magic does staticmethod() do, so that the static method is always called without the instance parameter?
Question: I am trying to understand how static methods work internally. I know how to
use `@staticmethod` decorator but I will be avoiding its use in this post in
order to dive deeper into how static methods wo... |
arch -i386 ipython notebook Error
Question: I have installed all the required packages to run the ipython notebook using
macports with the +universal build option. I can run ipython with arch -i386
ipython without a problem. I have successfully opened the notebook using the
64bit build. However, when I try to open the ... |
merge values of same key in a list of dictionaries , and compare to another list of dictionaries in python3
Question: **Update:** Apparently, I noticed that in my main code, when I extract the
values from the list of dictionaries that I get from readExpenses.py, I store
it as a set, not as a list of dictionaries.
Now,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.