text stringlengths 226 34.5k |
|---|
PyCharm Django test runner can't see django.sites (Runtime Error)
Question: When I run `manage.py test` everything is working normally, but if run test
with PyCharm Django Tests it gives me following error:
Error
Traceback (most recent call last):
File "/usr/lib/python3.4/unittest/case.py", lin... |
Syntax errors with interactive Sage cell
Question: I am trying to create a webpage which uses an interactive Sage cell to
implement the Vigenere Cipher on user-inputted strings. Code runs perfectly
when I run it outside of the interactive cell. See below:
message = 'Beware the Jabberwock, my son!'
ke... |
python selenium detect alert error si active
Question: on this [page](https://secure.ingdirect.it/login.aspx) when digit wrong data
open alert error, i need check if this alert is open, if is open need close,
im write this code bat not working :
example alert image : <http://snag.gy/8WM0q.jpg>
my actual code :
... |
Sending a JSON POST using urllib2 results in HTTP 422
Question: i have been having a problem sending a JSON request towards an API. I've added
application type headers though the API still responds with HTTP 422. The JSON
file data is valid, checked via jsonlint.
post_config = urllib2.Request(config_url)... |
How to parse a key value nested in another key whose name is not know in python?
Question: I'd like to access the value of extract key that is nested in the pages key
{
"batchcomplete": "",
"query": {
"normalized": [
{
"from": "sample",
... |
How to use sort_index() on a dataframe?
Question: I loaded JSON file in to a dataframe using spark SQLContext. It stores tweets
from different users. It looks like below. I am using pandas library in python
to explore the data in this dataframe.
import pandas as pd
tweets = pd.read_json('/filepath')
... |
Python: Getting specific list elements
Question: So I made a list of elements from a HTML-Page and counted the frequency of
these elements. But I just need some specific elements like "bb" and "nw". So
I don't know what position they'll have in the list and I'm not sure how to
seperate them from the other elements.
Th... |
variable in python dictionary for http header construction
Question: New to python but I'm trying to use a variable within a dictionary that is
used to construct a http header
This is what I have:
import requests
url = "https://sample.com"
auth = "sampleauthtoken"
headers = {
... |
Retrieving structs from .so files in Python
Question: I am attempting to write a .so library wrapper for an existing C source code
project, and then call the functions in the .so library from Python. I have
been able to call functions with primitive arguments and return types with no
problem, so I am now working on int... |
Selenium webdriver with python to scrape dynamic page cannot find element
Question: So there are a lot of questions that have been asked around dynamic content
scraping on stackoverflow, and I went through all of these, but all the
solutions suggested did not work for the following problem:
## Context:
* Using Sele... |
Error setting up Django registration
Question: So, I'm trying to set up `registration` and I keep getting the error
> Unhandled exception in thread started by
>
> Traceback (most recent call last):
>
> File "//anaconda/envs/hellovenv/lib/python2.7/site-
> packages/django/utils/autoreload.py", line 226, in wrapper fn(*... |
pip installing to wrong folder even though `which pip` is correct
Question: I'm using Mac OS X 10.10. I want to use pip to install packages for my
homebrew installed version of python (located in `/usr/local/bin/python`,
which is an alias that points to
`/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versi... |
Kivy Android Scikitlearn
Question: I'm trying to build a test Android application based on Kivy and Scikitlearn.
To build the apk I use buildozer. The code of the app is the basic Hello world
example. In the buildozer.spec file I add scikit-learn as an external library:
[app]
title = MyTest
... |
Python: how to make python calculate a sum to make sure an input is correct?
Question: I want to make python ask 10 questions and a user to have to input their
answers which works. However I also want python to say whether this is correct
or not by using the code below but this does not work and only moves onto the
nex... |
Dryscrape/webkit_server memory leak
Question: I'm using dryscrape/webkit_server for scraping javascript enabled websites.
The memory usage of the process webkit_server seems to increase with each call
to session.visit(). It happens to me using the following script:
import dryscrape
for url in u... |
Calculate distance between two coordinates on a globe
Question: I get two coordinate pairs in the form `90°0′0″N 0°0′0″E` as string and want
to calculate the distance between those points on a sphere with radius
R=6371km.
I found two formulas on the internet [here](http://www.movable-
type.co.uk/scripts/latlong.html),... |
Erasing screen with button
Question:
#Imported Pygame
import pygame
#The Colors
BLACK = ( 0, 0, 0)
GREEN = ( 0, 255, 0)
WHITE = ( 255, 255, 255)
RED = ( 255, 0, 0)
ORANGE = ( 255, 115, 0)
YELLOW = ( 242, 255, 0)
BROWN = ( 115, 87, 39)
PURPLE = ( 298, 0, 247)
GRAY = ... |
Python: logical comparing with columns in panda's dataframe
Question: I have a dataframe where I want to determine when the `ser_no` and `CTRY_NM`
are the same and differ. However, I want to be mindful of the `ser_no` changes
and not make a false and false return true or a false/true return false.
Consider the followi... |
Getting last ten codepad.org posts with Easy Html Parser (EHP) python
Question: I have found a python html parser that builds a dom like structure for html
sources it seems easy to use and very fast. i'm trying to write a scraper for
codepad.org that retrieves the last ten posts from <http://codepad.org/recent>
The EH... |
AttributeError: 'module' object has no attribute 'Screen'
Question: I'm trying to make a square with python. Here's the code:
import turtle
def draw_square():
window = turtle.Screen()
window.bgcolor("red")
brad = turtle.Turtle()
brad.shape("turtle")
... |
Error using FigureCanvasQTAgg in MatplotlibWidget pyqt5
Question: I would like to plot on my GUI with pyqt5 using matplotlib. I have created a
class called MatplotlibWidget which create the figure and canvas of my plot.
But I have a problem to generate my canvas with the FigureCanvasQTAgg function
(which is a matplotli... |
How to customize button ok in Gtk.MessageDialog with CSS?
Question: My day's question is about apply CSS in default button in Gtk.MessageDialog. I
tried a lot things without result.
The deal is to find th good id like buttons, or GTKbutton, or
GtkMessageDialog.Button,......
#!/usr/bin/env python
... |
Opening a new window when we click on a button in wx python
Question: I am new to python . I want to open a new window when I click on button OK. I
am having the following code but getting error. I googled it but got few
answers but didn't get that how to make it work
import wx
class MyFrame(wx.... |
Python/PyQT: How can I truncate a text in QLineEdit
Question: I am looking for a solution for my problem. What did I do? I wrote a subclass
named _ExtendedTruncateTextLineEdit_ that inherits from QLineEdit. What I
want? Well, I want to **truncate a text** in a Qwidget named **QLineEdit** ,
when you resize the window an... |
Import package from PYPI
Question: I use the "pip install xxx" from PYPI (<https://pypi.python.org/pypi>). Then I
type "import xxx", it can import package without any problem.
However, when I uploaded my package to PYPI, Then I type "import xxx", it
cannot import package. It said "ImportError, no module named xxx".
I... |
python script slow read and write gz files
Question: I have a xxx.wig.gz file, that have 3,000,000,000 lines in such format:
fixedStep chrom=chr1 start=1 step=1
0
0
0
0
0
1
2
3
4
5
6
7
8
9
10
...
fixedStep chrom=chr2 start=1 step=1
0... |
How to pass images to the model for classification in Tensorflow
Question: I have created a model using the following code below:
# Deep Learning
# In[25]:
from __future__ import print_function
import numpy as np
import tensorflow as tf
from six.moves import cPickle as pickle... |
Using Sacred Module with Python
Question: I am trying to set up `sacred` for python and I am going through the tutuorial
here - <http://sacred.readthedocs.org/en/latest/quickstart.html>. I was able
to set up sacred using `pip install sacred` with no issues. I am having
trouble running the basic code:
fro... |
Restarting Heroku Python script periodically
Question: I made a **Flask-Python** web application that scrapes the fixture of Real
Madrid and displays it in a neat countdown page. I am trying to host it via
**Heroku**. i moved the scraping part to the main python script and passed the
scraped variables via **render_temp... |
Py 3: tkinter frames, coding inside or outside of frame classes
Question: So I'm creating a GUI mathematical program for school using python 3 and
tkinter where we have to ask the user what formula they want to use (add, sub,
multiply, divide) and then ask 10 questions show a results page once all 10
questions have bee... |
Can't Import a file in different directory using Python
Question: I have a python module at
`/home/amit/folder1/folder2/folder3/folder4/folder5/nbsearch` named
**neighbourhoodsearch.py**. I have included a class in this file in another
module at `/home/amit/folder1/folder2/folder3/folder4/controller` named
**nbsearch_c... |
Negative pattern matching Reg ex In Python
Question: Tryto use negative forward to replace all string which does not match a
pattern:
regexPattern = '((?!*' + 'word1|word2|word3' + ').)*$'
mytext= 'jsdjsqd word1dsqsqsword2fjsdjswrod3sqdq'
return re.sub(regexPattern, "P", mytext)
#Expec... |
Issue in storing regexp of multiple lines in python
Question: I am having the following pattern in text file
Question1: Quesion XYZ
a. option1
b. option2
c. option3
d. option4
Question2 : Question next
a. option1
b. option2
c. option3
d. option4
so on mul... |
creating a list from json csv file using python
Question: I am sorry for asking this question, but i already look through but could not
find the answer. I am honestly newbie.I am trying to generate a list of whole
word from a json csv file. I already created a list of lines, but then i
cannot use split() to generate ne... |
GetLastInputInfo and GetTickCount are not consistent with each other
Question: I am trying to work out how long, approximately, the current user has been
idle (e.g. like [this question](http://stackoverflow.com/questions/203384/how-
to-tell-when-windows-is-inactive)), from Python on a Windows machine.
To do that, I fi... |
Python: how to compute the Euclidean distance distribution of a regular network?
Question: I have an `NxN` regular network, each node of which has an `(X,Y)` set of
coordinates. The nodes are separated by the _unit_. The network looks like
this:
(0,0) (1,0) (2,0)
(0,1) (1,1) (2,1)
(0,2) (1,2) (2,... |
Docker image builds on laptop, not on Digital Ocean - my understanding of Docker is shattered
Question: I have a non-trivial `Docker` environment for a Python app I'm building (see
below for full `Dockerfile`). On my MacBook (with `Docker version 1.10.3,
build 20f81dd`) I am able to build the `Docker` image, run the co... |
padding numpy array/matrix with string
Question: I am trying to read a multi-band image in a python code. My requirement is to
form a neighborhood matrix. So I need to pad the matrix with with some number
so as to be able to form neighborhood for each element. Ex. a is a matrix,
padding with 0
a= |1 2 3 ... |
Python: How to remove quotes around numbers from string
Question: I have a python string like this:
"""
{id: 'id_0_4', value: '8450223051', name: 'XAD3', parent: 'id_0'},
{id: 'id_0_5', value: '509071269', name: 'ABSD', parent: 'id_0'}
"""
From the string, I want to remove the single qu... |
Block of code as a separate module in Python
Question: Assume I have a list `my_list`, a variable `var`, and a block of code that
modifies the list using the variable
my_list = ['foo']
var = 'bar'
my_list.append(var)
In the actual task I have a lot of variables like `var` and a lot of comma... |
Seeded Python RNG showing non-deterministic behavior with sets
Question: I'm seeing non-deterministic behavior when trying to select a pseudo-random
element from sets, even though the RNG is seeded (example code shown below).
Why is this happening, and should I expect other Python data types to show
similar behavior?
... |
PYTHON: nosetests import file path with multiple modules/files
Question: I'm currently working through
[LearnPythonTheHardWay](http://learnpythonthehardway.org/book/ex48.html) and
have reached [Exercise 48](http://learnpythonthehardway.org/book/ex48.html)
which details **Nosetests**. I am able to perform a unit testing... |
How to constrain function parameter's protocol's associated types
Question: For fun, I am attempting to extend the Dictionary class to replicate Python's
Counter class. I am trying to implement `init`, taking a `CollectionType` as
the sole argument. However, Swift does not allow this because of
`CollectionType`'s assoc... |
Strange TypeError with Theano
Question:
Traceback (most recent call last):
File "test.py", line 37, in <module>
print convLayer1.output.shape.eval({x:xTrain})
File "/Volumes/TONY/anaconda/lib/python2.7/site-packages/theano/gof/graph.py", line 415, in eval
rval = self._fn... |
Python Splinter browser = Browser() not working
Question: I am trying to use splinter to test my webapp. When I try to execute the
following
>>> from splinter import Browser
>>> browser = Browser()
I get this error. I have been looking around but I'm not sure how to fix.
Could someone please te... |
Spark RDD problems
Question: I am starting with spark and have never worked with Hadoop. I have 10 iMacs on
which I have installed Spark 1.6.1 with Hadoop 2.6. I downloaded the
precompiled version and just copied the extracted contents into
`/usr/local/spark/`. I did all the environment variables setup with
`SCALA_HOME... |
Unicodedata.normalize() ValueError: invalid normalization form
Question: I'm trying to take foreign language text and output a human-readable,
filename-safe equivalent. After looking around, it seems like the best option
is `unicodedata.normalize()`, but I can't get it to work. I've tried putting
the exact code from so... |
Windows Error dialog - 'Errors occurred' - Where is this coming from?
Question: I am dealing with a legacy Python application which uses WxPython, InnoSetup
and py2exe and has a custom sys.excepthook that should deal with all
exceptions. Yet, when an exception occurs, after the custom exception handler
has finished and... |
Pythoncially check if a variable name is valid
Question: tldr; see the final line; the rest is just preamble.
* * *
I am developing a test harness, which parses user scripts and generates a
Python script which it then runs. The idea is for non-techie folks to be able
to write high-level test scripts.
I have introduc... |
How to make Tkinter button to be placed in particular position?
Question: I am new to python so I was trying to make a GUI, in that i have to place a
button in a particular position. I tried using
`self.nxt_form.place(x=200,y=100)` instead of `self.nxt_form.pack()` but the
button disappeared and only the frame appeared... |
Python 3: Sympy: Include list information to optimize lambdify
Question: I use `lambdify` to compile an expression which is a function of certain
parameters. Each parameter has `N` points. So I need to evaluate the
expression `N` times. The following shows a simplified example on how this is
done.
import... |
How to Catch Exception in youtube-dl in python?
Question: I use youtube-dl in python, sometime I got ContentTooShortError, how can I use
"try...catch..." in python to deal with these exceptions?
I use this code but it doesn't work
with youtube_dl.YoutubeDL(options) as ydl:
# youtube_url = video.... |
running command via subprocess on Windows with spaces in filenames
Question: To run a command in python, for Windows, I do:
import subprocess
subprocess.check_output(lsCommand, shell=True)
where `lsCommand` is a list of strings that make up the bash command. This
works, except when it contains ... |
Python with Google Analytics Querying a specific Google Account from Googles scripts
Question: I am quite new to Python and got the following script from Google Analytics
API help. I have got it working and extracting data, however, it specifies to
get the first google account, I have multiple GA accounts and wish to s... |
Cannot see all tabs in ttk.Notebook
Question: I have some trouble with the tabs from the ttk Notebook class in python 2.7. I
cannot see all the tabs I create.
I made a minimal code to view the problem:
from Tkinter import *
import ttk
root = Tk()
nb = ttk.Notebook(root, width=320, heigh... |
Multi-threaded asyncio in Python
Question: I'm currently doing my first steps with asyncio in Python 3.5 and there is one
problem that's bugging me. Obviously I haven't fully understood coroutines...
Here is a simplified version of what I'm doing.
In my class I have an open() method that creates a new thread. Within ... |
Getting error "cannot marshal None" in spite of adding allow_none=True while using XMLRPC in Python
Question: I've tried to create a simple download and upload system using XMLRPC in
Python
Here is the code for client (name this file as client.py)
import sys
import xmlrpclib
import os
d... |
My escape event isn't working
Question: I'm trying to make a program that when I press escape on the window appears a
label "You pressed Escape".
from tkinter import *
class the_Esc_test(Frame):
def __init__(self):
Frame.__init__(self)
self.start_number=0
sel... |
Python: doing multiple column aggregation in pandas
Question: I have dataframe where I went to do multiple column aggregations in pandas.
import pandas as pd
import numpy as np
df = pd.DataFrame({'ser_no': [1, 1, 1, 2, 2, 2, 2, 3, 3, 3],
'CTRY_NM': ['a', 'a', 'b', 'e', 'e', 'a... |
Python sklearn.datasets.dump_svmlight_file failed to output the right index of column
Question: I want to execute SVM light and SVM rank,
so I need to process my data into the format of SVM light.
But I had a big problem....
My Python codes are below:
import pandas as pd
import numpy as np
fro... |
Returning different values based on where function is called from in Python
Question: I have two functions, each of which call a third function, but expect a
slightly different thing returned back.
All functions are in separate files. Files A and B can NOT import one another,
so function A and B can not call one anoth... |
Dynamic matplotlib pyside widget not displaying
Question: I'm writing a python application using pyside and matplotlib. Following a
combination of [this
tutorial](http://matplotlib.org/examples/user_interfaces/embedding_in_qt4.html)
and [this SO post](http://stackoverflow.com/a/9082596/160300), I have created
a matplot... |
How can I get only the latest file/files created/modified on S3 location through python
Question: using boto i tried the below code :
from boto.s3.connection import S3Connection
conn = S3Connection('XXX', 'YYYY')
bucket = conn.get_bucket('myBucket')
file_list = bucket.list('just/a/p... |
Why is my print function printing the () and the "" along with the statement?
Question: _This is my code for a challenge in Python Programming for the Absolute
Beginner_
food = input("What is your favorite entree? ")
dessert = input("What is your favorite dessert? ")
print("... |
Gunicorn failed to load Flask application
Question: I have a Flask app I am trying to serve via Gunicorn.
I am using virtualenv and python3. If I activate my venv cd to my app base dir
then run:
gunicorn mysite:app
I get:
Starting gunicorn Listening at <http://127.0.0.1:8000>
DEBUG:mysite.setting... |
Python logging levels are behaving inconsistently
Question: I can't understand why the following code does not produce my debug message
even though effective level is appropriate (output is just `10`)
import logging
l = logging.getLogger()
l.setLevel(logging.DEBUG)
l.debug("Debug Mess!")... |
Delete rows pandas Dataframe based on index (multiple criteria) (Python 3.5.1)
Question: Suppose I have a Pandas DataFrame with MultiIndex on rows. How can I delete
rows based on the value of one of the levels of the index based on multiple
criteria?
For example, suppose I have
import pandas as pd
... |
Python: compute average of n-th elements in list of lists with different lengths
Question: Suppose I have the following list of lists:
a = [
[1, 2, 3],
[2, 3, 4],
[3, 4, 5, 6]
]
I want to have the average of each n-th element in the arrays. However, when
want... |
decrease string in python doesn't works
Question: I have a problem to cut the url that i get as result from Beautifulsoup, i've
used this code to retrieve the url.
import urllib2
from bs4 import BeautifulSoup
url = 'http://192.168.0.184:88/cgi-bin/CGIProxy.fcgi? cmd=snapPicture&usr=USER&pwd=... |
kivy fatal error due to OpenGL requirement on windows desktop
Question: I have written a windows desktop application using Python 2.7 and kivy that
runs perfectly well from the pyCharm IDE and from the python commandline.
After building a distribution package using PyInstaller, running the
application from the ..\dist\... |
python mysql error in query
Question: I want to generate a dynamic table:
columnames=[element[0] for element in bufferdata['data'] ]
for index,element in enumerate(columnames):
columnames[index]=re.sub("[(%./)-]","",element)
tuple(columnames)
querycreatetable='''CREATE TAB... |
How to compare more than 2 Lists in Python?
Question: I am new to Python as well new on Stackoverflow , can anyone tell me
efficient(pythonic) way to compare more than 2 Lists ? I want to enlist all
the elements of all 3 Lists and display in such fashion that user will be able
to know that which element is present in a... |
How to build a new list from a list in Python?
Question: I have a python list that contains a set of objects (a class that has it's own
properties and functions and variables). I would like to extract some of the
list elements and create a new list.
My question is: Are the new list elments going to remain same or they... |
Python FFMPEG AttributeError: 'Popen' object has no attribute 'proc'
Question: I'm working on a tensorflow project that learns from an audio stream. I'm
trying to open an audio file and store the data in an array using FFMPEG. I'm
following the tutorial [here](http://zulko.github.io/blog/2013/10/04/read-and-
write-audi... |
How to list MAC Address of an AWS EC2 instance with Python and boto3
Question: how to find out information about MAC address of Amazon EC2 instances using
the Python boto3 library.
Answer: Assuming you have one network interface attached to your instances. If you
have more than one network interface attached to your ... |
The result of running time calculated by Python is not correct
Question: I trying to use time to record running time of this function, but i think the
result is not correct, sometimes it will only cost 0s and the result is not
stable.[The first two result is for N=10000, the third one is
N=30000](http://i.stack.imgur.c... |
Why I am not able to decrypt what I encrypted with pycrypto?
Question: Here's my code:
Encrypt:
from Crypto.Cipher import AES
import base64
def encryption (privateInfo):
BLOCK_SIZE = 16
PADDING = '{'
pad = lambda s: s + (BLOCK_SIZE - len(s) % BLOCK_SIZE) * PADDING
... |
Python module distribution installs executable to path
Question: In the past I saw Python module distributions on PyPI which installed an
executable to the path when you installed them with `pip`, unfortunately I
can't find one like this anymore.
I wonder how this is possible. Would you do this in your `setup.py`? Can... |
constructor and method overriding in Python
Question: I am trying to figure out if there is a way to override the `__init__` method
in a python class. I have come up with this, not exactly method overriding but
it has the same effect
class A():
def __init__(self, x):
if isinstance(x, ... |
python 3 cleaner code, calculating values from dictionary
Question: Currently my code is working and usable but I think there are a few lines of
code that I do not need. I am inputting a sequence (of DNA) and having the
code calculate some values and returning the values to me. I input the
sequence, and then a concentr... |
Raspberry pi:convert fisheye image to normal image using python
Question: I have attached the USB webcam with raspberry pi to capture image and write
code to send it using mail. It captures image using `fswebcam` commamnd so
code for capture image in python script is :
subprocess.Popen(["fswebcam","-r 64... |
Python Session variable
Question:
def get_items_from_cart(self):
""" Fetches items from sessions cart"""
item_list = []
cart_count = self.session.get('add_to_cart_count')
if not cart_count: return None;
for i in range(1, cart_count+1):
item = self.session.get(str... |
How to create set of image files in folder using python and PIL
Question: I am resizing a set of images and storing resized image to new folder.my
sample code is
import cv2
import PIL
import Image
import os
def resize_all(path1,path2):
resolution = (200,200)
scaler = Image.... |
Javascript - call super on parents parent?
Question: I have defined this extension of current custom javascript view in Odoo:
openerp.account_move_journal_test = function(instance){
var _t = instance.web._t,
_lt = instance.web._lt;
var QWeb = instance.web.qweb;
instanc... |
How to convert CJK Extention B in QLineEdit of Python3-PyQt4 to utf-8 to Processing it with regex
Question: I have a code like that:
#!/usr/bin/env python3
#-*-coding:utf-8-*-
from PyQt4 import QtGui, QtCore
import re
.....
str = self.lineEdit.text() # lineEdit is a object in QtGui.QL... |
How can I loop through a list of strings?
Question: I have this code:
test = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O"]
for i in test:
if i not in ["C","D"]:
test.remove(i)
print(test)
I was expecting to get `['C','D']` as a result of running... |
Python first x-y-ticks overlapping
Question: I am working on this problem for over an hour now, but all i tried failed so
far. In my plot the first values on x and y axes keep overlapping. I am using
tight layout to fix this problem, but it does not help. Also my z-ticks are
overlapping with the Z-axis. Thanks for any ... |
Mean squared displacement
Question: I am investigating the motion of a single micrometer sized particle in a low
density plasma. With a so called long distance microscope I have recorded the
motion of a particle (2726 images, fps=60 Hz).
The x,y data in mm are available here: <http://pastebin.com/qdMsaUHD>
With mathe... |
define a regular expression in python
Question: I am trying to use regular expressions in python to say a 4 characters string
with 1st character being a digit and 3 other characters being either a digit
or a capital letter. Here's examples of patterns that should match 1CTT, 2IR8,
35TR, 4T1R
I tried many ways, here's ... |
memcached listeing on UDP with Django
Question: **Question** : I am not able to get `memcached` listening on `UDP`, to work
(`get` `set` `delete`) with Django.
* * *
I have the memcached listening only on `UDP` `11211`, as I have mentioned in
the [previous question](http://stackoverflow.com/questions/36055900/get-set... |
How to create a user in the Moodle Rest WS using the Python Requests module?
Question: I'm trying to create a user using the Moodle Webservices - Rest Server, but
I'm stuck at the validation of the params :S My code is the following:
import requests
token = 'TOKENNUMBER'
function = 'core_use... |
Python, probably a simple solution with dictionary and functions but dont know how
Question: So...I am doing a volunteer school project (building a quadcopter) and have
been sitting here for a very long time trying to solve the problem...:
Basically, i was able to start the motor at a certain speed per remote control
... |
How to group by quarter and calculate average from an array using numpy?
Question: I'd like to utilize numpy to calculate the average of a set of values in each
quarter from the below array:
Data = [{'date':'2015-01-01',value:5},{'date':'2015-02-01',value:6},{'date':'2015-03-01',value:7},{'date':'2015-04... |
Is there a way to simplify this "n-way merge" in python
Question: So right now I've hardcoded 4 if/elif/else statements. There there a more
dynamic way to do this? For example if I wanted to do a 10 or eve a 40 way
merge?
#4-way merge sort, sorted page files
outfile="fullsorted.txt"
of=open(outfi... |
Using Dictionaries to Count First Letter in a String - Python
Question: I've been working on a dictionaries exercise in Python, and I'm fairly new to
the language and programming in itself. I've been trying to take a string or
list of strings and have my code compare the first letter of the strings and
make a dictionar... |
Import Cython class in Python file Pycharm
Question: How does one import a compiled cython file in a pycharm python file?
Here is my setup.
From my project root directory, the cython class is
"/classes/knn.cpython-35m-x86_64-linux-gnu.so." My python file is
"/classes/testing_cython_knn.py."
I have an "__init __.py" ... |
Python: TypeError: coercing to Unicode: need string or buffer, module found
Question: I am new to Python, just learning.
I am taking one of the file as input and I want to print the text on the
console using python.
# This will take the file as input
import fileinput
for line in fileinput.i... |
How can I use a Google Chrome extension with Selenium?
Question: I am trying to scrape match information from the a page like this one (page is
in the same format, but obviously has different values for different matches):
<https://csgolounge.com/match?m=8967>
The problem is, the information that I want is only displa... |
python relative import error when referencing file
Question: Now I got relative imports to work by [following
this](http://stackoverflow.com/a/15458607/3834059). But I am getting some
errors where the files are referenced with the wrong relative paths.
My folder structure is something like this
spamfilt... |
Python Random function
Question: Write a program to create an array of random numbers between 1000 to 2000 and
count the number of values that are higher than 1500.
I've kind of have the understanding of setting the range, but not counting the
number of returns.
What I have is this:
import random
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.