text stringlengths 226 34.5k |
|---|
"Delayed" writing to file in python
Question: I have very specific problem and I have no idea how to get rid of it. I'm
sending some data over php client on webserver. Code looks like this:
<?php
session_start();
include 'db_con.php';
include('db_functions.php');
error_reporting... |
Spark-SQL Window functions on Dataframe - Finding first timestamp in a group
Question: I have below dataframe (say UserData).
uid region timestamp
a 1 1
a 1 2
a 1 3
a 1 4
a 2 5
a 2 6
a 2 7
a 3 8
a 4 9
a 4 10
a 4 11
... |
How to avoid Python script name being regarded as namespace with Doxygen
Question: I am now making documentations with Doxygen for Python scrips. Suppose the
name of the script is `all_the_best.py`, and at the beginning of the scripts,
I document it as follows:
##
# @namespace scripts.python
# T... |
Execute python in PHP and get response as i get in terminal
Question: i am new to PHP Programming. I need to execute a python code from php. My
Python code contains some external modules. The Php code is
$op=shell_exec('python mgs.py');
echo $op;
?>
This is my intended code and i need ... |
RuntimeWarning: invalid value encountered in arccos
Question: I am new to using Python but getting along with it fairly well. I keep getting
the error you see below and not sure what the problem is exactly as I believe
the values are correct and stated. What do you think the problem exactly is? I
am trying to graph fro... |
Using a function as argument to re.sub in Python?
Question: I'm writing a program to split the words contained in an hashtag.
For example I want to split the hashtags:
#Whatthehello #goback
into:
What the hello go back
I'm having troubles when using
[`re.sub`](https://docs.pyt... |
access file's actual code as string Python
Question: this is mainly curiosity, I'd like to access my script's actual code, so for a
file:
#!/usr/bin/env python
# coding: utf-8
import os, sys, subprocess, time, re
import yagmail
it would return
code = """\
#!/usr/... |
Upgrading Django from 1.8.6 to 1.9--django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet; importing models issue
Question: I'm trying to upgrade from Django 1.8.6 to 1.9 but I've been running into
trouble with trying to get the project to build and run properly. I've changed
numerous things necessary for ... |
I installed pydicom through pip but it somehow cannot be found when I try to import the library. Could someone give a suggestion to fix this?
Question: [Please see the screenshot here.](http://i.stack.imgur.com/90HbA.png)
Isn't the package pydicom already installed?
Credit to Igor: It looks like that it's working in ... |
Python pandas: Identify route/path given by two columns
Question: I have an input file (csv-file) with data which has duplicate entries in the
column `group` and might have duplicate entries in the column `size`.
A snippet with the data of just one group is given below. However, there are
several groups in the real da... |
Strange Python behaviour with regex module
Question: I have been playing around with the [improved regex
module](https://pypi.python.org/pypi/regex) for Python by Matthew Barnett and
found a strange error (behaviour? bug?).
Consider the following code:
import regex as re
string = "liberty 123, equa... |
Valid JSON using Python
Question: Is this a valid JSON object?
{"Age": "2", "Name": "Rice, Master. Eugene", "Parch": "1", "Pclass": "3", "Ticket": "382652", "PassengerId": "17", "SibSp": "4", "Embarked": "Q", "Fare": "29.125", "Survived": "0", "Cabin": "", "Sex": "male"}
Do I need an EOF?
I have u... |
File parsing using commas Python
Question: I am trying to write a program in python in which we have to add the numbers
from different categories and sub-categories. The program is about a farmer's
annual sale of produce from his farm. The text file from where we have to read
from has 4 categories. The first category i... |
Count down error
Question: This code generates an error and I am not sure why or how to resolve it?
File "/Users/johnz/Dropbox/PythonWorkspace/BumpersRev1/test3.py",
line 7, in countdown
if self.remaining <= 0:
AttributeError: 'int' object has no attribute 'remaining'`
.
... |
google storage python JSON client eternal 502 when uploading media to bucket
Question: This is my first time using Google Storage json api, and I am trying to do a
simple image file _UPLOAD_ to a bucket using the python client library. It
seems that I am correctly getting credentials (application default) because I
can... |
Unable to access windows controls inside pywinauto's hwndwrapper (wrapper class
Question: [enter image description here](http://i.stack.imgur.com/BTJpy.png)I am new to
python and pywinauto. Trying to set or get Text for TextBox (windows control)
inside pywinauto.controls.hwndwrapper.hwndwrapper by using SWAPY, I have C... |
Compare files with a zip list and figure out if it is larger
Question: I want to compare the files of two zip folders. Copy only if the magnitude is
greater when there is already a zip at the end when missing an equal name,
copy the file. Only Name is compared not a date: es--> Campobasso[CB]-Molise
Folder DirTemp ZIP... |
Using 2 dictionaries in python
Question: I'm trying to create a code that if the user types his first name and his
middle name initial into the input it will add the two dictionary numbers
together.
**For the first name values I want:**
d['a'] = 0
d['b'] = 60
d['c'] = 100
d['... |
How to prevent Panda's itertuple method from adding extra decimals to records from a csv file? -Python
Question: I have a Python function that reads through a csv file and returns each row in
the csv in a tuple.
I'm using Python's Pandas library to achieve this.
The problem is after Pandas returns the tuple, it appen... |
2D array to represent a huge python dict, COOrdinate like solution to save memory
Question: I try to update a dict_with_tuples_key with the data from an array:
myarray = np.array([[0, 0], # 0, 1
[0, 1],
[1, 1], # 1, 2
[1, 2], # 1,... |
Python: Create set by removing duplicates in text processing?
Question: Let's say a text file with two columns like below
A "
A "
A l
A "
C r
C "
C l
D a
D "
D "
D "
D d
R "
R "
R "
R "
S "
S "
S o
D g
D "
D "
D "
... |
python manipulating files, logic error in script?
Question: I have a file that looks like this:
**Chr-coordinate-coverage**
chr1 236968289 2
chr1 236968318 2
chr1 236968320 2
chr1 236968374 2
chr1 237005709 2
chr14 22086843 2
chr14 22086846 2
... |
python error run from cmd
Question: For my coursework i am doing a booking system which uses some tree views. The
problem is that if ran from cmd when i double click on a row in the tree view
it does not populate the boxes below it, however if i run it from the idle it
does. Below is my where i have made my class and t... |
import graph tool doesn't work on iPython
Question: I installed graph-tool on ubuntu. When trying to import it in iPython I get an
error:
ImportError: No module named graph_tool.all
As I read in other posts it might be possible that I used a different version
of python for installing graph-tools th... |
Python Nosetest multi-processing enable and disable at Class/Package level
Question: So I have a directory with sub-directory of Acceptance Tests. Most of my tests
have no dependancies on each other, expect for one suite. Is there a way I can
tell nose when it reaches this class to execute the tests sequentially. Then
... |
Weird EOFError with python and paramiko
Question: my code:
#!/usr/bin/env python
# encoding: utf-8
import paramiko
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('10.X.X.X',username='user',password='password')
stdin,... |
ssh + here-document syntax with Python
Question: I'm trying to run a set of commands through ssh from a Python script. I came
upon the `here-document` concept and thought: cool, let me implement something
like this:
command = ( ( 'ssh user@host /usr/bin/bash <<EOF\n'
+ 'cd %s \n'
... |
I was wondering how I would implement the vigenere cipher in python
Question: I was tasked to create a caesar cipher in the past and now I am trying to
implement the viginere cipher in python. I want to know how I would go about
doing this. I have a basic idea of using variables from the user as
'plaintext' and the alp... |
django celery rabbitmq issue: "WARNING/MainProcess] Received and deleted unknown message. Wrong destination"
Question: My settings.py
CELERY_ACCEPT_CONTENT = ['json', 'msgpack', 'yaml', 'pickle', 'application/json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_RESU... |
Keep getting a 'SyntaxError: unexpected EOF while parsing' when running my app, can't figure out why
Question: I'm using the python 3 idle, and it's not highlighting anything to tell me
what the syntax error is. Mentions it's in line nine, though I can't see it.
Here's the code, it's a school project for a 'speed chec... |
errno 9 bad file descriptor, basic python server socket
Question: I'm having difficulty with getting data from a server in python. I'm getting
Errno 9 bad file descriptor and a 'connection was reset' message on my browser
whenever I try to access my test html file. The code is as follows:
#import socket ... |
generates all tuples (x, y) in a range
Question: I'd like to know what is the pythonic way to generate all tuples (x, y) where
x and y are integers in a certain range. I need it to generate n points and I
don't want to take the same point two or more times.
Answer: The most Pythonic way is to use the standard library... |
Anaconda not able to import the packages like numpy, scipy, theano etc
Question: Without installing Anaconda, everything works fine. That is, I am able to
import the above mentioned packages. But after installing Anaconda, I am not
able to import the same packages. Here is the error which I get: -
>>> im... |
TF save/restore graph fails at tf.GraphDef.ParseFromString()
Question: Based on this [converting-trained-tensorflow-model-to-
protobuf](http://stackoverflow.com/questions/35247406/converting-trained-
tensorflow-model-to-protobuf) I am trying to save/restore TF graph without
success.
Here is saver:
with ... |
different versions of python missing pymssql
Question: I have python2.7.3 in /usr/bin/
this version can import pymssql without error
i have python2.7.11 in /usr/local/bin/
this version gets an error when importing pymssql
$ sudo pip install pymssql
Requirement already satisfied (use --upgr... |
Using input redirection command ("<") in IPython
Question: In windows command line, I am using the [redirection operator
("<")](https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-
us/redirection.mspx?mfr=true) to read input from a file. To run my python
module, I would do something like:
`pyt... |
How to include text within a python file
Question: There are several questions related to reading python code from external
files, including
[Python: How to import other Python
files](http://stackoverflow.com/questions/2349991/python-how-to-import-other-
python-files)
[How to include external Python code to use in ot... |
Python - Replace value in JSON file from second file if keys match
Question: I have two JSON files that look like this
{"type": "FeatureCollection", "features": [{ "type": "Feature", "properties": { **"id"**: "Carlow", **"density"**: "0" } , "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [ -6... |
Resetting Python list contents in nested loop
Question: I have some files in this format that I need to return the oldest and newest
files to pass to a function for parsing
Nv_NODE_DATE_TIME
I would like the output to be
Nv_stats_172550_160211_230030
Nv_stats_172550_160212_142624... |
ImportError: No module named version in Astropy
Question: I currently have an anaconda installation of of Python, which includes astropy
and numpy among other useful packages. I recently updated my Astropy
individually through pip, by running
pip install --upgrade astropy
After this silly thing tha... |
Python install location on OSX - trouble installing python modules
Question: I'm having a problem installing python packages and I think it has to do with
the fact that I apparently have 4 Python directories. I can download and
install them without a problem using pip... but when trying to import them in
an IDE they do... |
Python3 - TypeError: module.__init__() takes at most 2 arguments (3 given)
Question: Please don't mark as duplicate, other similar questions did not solve my
issue.
This is my setup
/main.py
/actions/ListitAction.py
/actions/ViewAction.py
Main.py:
from actions import ListitA... |
Cannot parse a protocol buffers file in python when using the correct .proto file
Question: _(see update at bottom)_
[Tilemaker](https://github.com/systemed/tilemaker) is an
[OpenStreetMap](http://www.openstreetmap.org) programme to generate [Mapbox
vector tiles](https://www.mapbox.com/developers/vector-tiles/) (which... |
Python: for loop stops at first row when reading from csv
Question: With this code, I can get it to fire thru the first row in a csv and post the
content. Without the for loop, it works great as well. I am also, using a
simple print statement, able to print out all of the rows in the csv. Where
I'm getting stuck is how... |
Access state of object (tkinter, Python3) beginner's level
Question: What I want to get: change of checkbox state changes the state of the Entry
widget from 'disabled' into 'normal'. (checkbox off = Entry disabled, checkbox
on = Entry normal). My problem is that I don't know how to access and update
the state of entry.... |
PyQT4, Python27 - Serial connection and global variables
Question: I think my issue is simple, but I have hit a brick wall. I am not a programmer
but needed a program to control a laser engraver via Arduino. My Original code
was mostly working, but I wanted the ability to select a serial port with a
QComboBox so I can ... |
Key bindings don't work when using askopenfilename dialog in tkinter
Question: I'm working on a simple app for reading and displaying sequences of image
files from within a zip file using python 3.4 with tkinter, like you might use
for reading .cbz comic book files. Ideally I'd like to bind the left and right
keys to s... |
I have a list of strings paired with a number. I want to find the average value for each word that matches to a list of words. How can I do this?
Question: Below is an example of what I am referring to. 'injury' is located both in the
second and third string with a value of 100,000 and 50,000 respectively. So
the avera... |
dynamic table names with SQLalchemy
Question: I am trying to convert old sqlite3 code to sql alchemy. I am trying to make
sense of how best to handle my use case. I am new to the ORM method of
database access.
I am trying to dynamically generate unique table names based on a common
definition. I have read the [mixins
... |
Parsing an ArrayList within an ArrayList not working.
Question: I'm new to Java and I'm trying to learn how to parse through an ArrayList
within an ArrayList and I can't quite figure it out. I'm used to Python where
all you had to do was `list[index][index]`. Why am I getting an error reading
`Exception in thread "main... |
Pygame independent moving images on the screen
Question: I am new to Python and Pygame. I want to have a screen in pygame with multiple
copies of the same images moving around independently. I have tried to write
it as a class and then call instances of it inside the `while` loop, but it
doesn't work. Could someone sho... |
Retrieving arguments from HTTP_REFERER string
Question: I am currently building a Python/Django application where I have a search
function and is looking great.
`http://localhost:8000/search/?q=&start=Feb+13%2C+Sat&end=Feb+20%2C+Sat`
Then say I selected a link from the number of listed results the led me to the
detai... |
What does y_p :::python do in this (or any) script?
Question: I am trying to work through the tutorial by Sebastian Raschka on Feature
scaling and I can't get the code below to run because it throws and error with
the third line, the one that end in 'python'.
from matplotlib import pyplot as plt
... |
ValueError: Found arrays with inconsistent numbers of samples [ 6 1786]
Question: Here is my code:
from sklearn.svm import SVC
from sklearn.grid_search import GridSearchCV
from sklearn.cross_validation import KFold
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn i... |
python rock paper scissors
Question: Im new to programming and trying to build a simple rock paper scissors program
in python 2.7. in my function i have 2 main if statements
rules = raw_input("Before we being playing would you like to hear the rules first? ")
if rules.lower() == "yes":
print ... |
Read environment variables in Python
Question: I have set some environment variables in `~/.profile`:
SOMEVAR=/some/custom/path
and already did `source ~/.profile`. So when I do:
echo $SOMEVAR
it prints the correct directory:
/some/custom/path
However, when... |
No module named Win32com.client error when using the pyttsx package
Question: Today, while surfing on _Quora_ , I came across
[answers](https://www.quora.com/What-amazing-things-can-Python-do) on amazing
things that python can do. I tried to use the **pyttsx** _Text to Speech
Convertor_ and that gave me an `No module n... |
Real-time capture and processing of keypresses (e.g. keypress event)
Question: _Note: I want to do this without using any external packages, like PyGame,
etc._
I am attempting to capture individual keypresses as they arrive and perform an
action for specific characters, whether I simply want to "re-echo" the
character... |
Python ImportError - Custom Module
Question: I have installed a custom module (Twilio) using PIP, but when I try to
`import` it, it will bring up:
ImportError: No module named 'twilio'
I'm running Windows 10 and Python 3.5. What am I missing? It seems to be an
error with the paths. If it is, how do... |
Implicit OAuth2 grant with PyQt4/5
Question: I have been working on a python app that uses OAuth2 to identify users. I seem
to have successfully implemented the workflow of an OAuth2 implicit grant
(commonly used for installed and user-agent apps), but at the last step of
receiving the token, something appears to be go... |
Fonts aliasing in Pillow
Question: I'm using Pillow 3.1.1 image library and Python 3.5.1.
I'm trying to use Pillow for drawing fonts on images. But results looks
absolutely ugly and unacceptable.
1st example: looks like font not antialiased. But docs contains absolutely
nothing on aliasing fonts. I've tried to make s... |
To generate basic bar graphs using python
Question: I am a newbie to python. Please help me with this error.My idea is to generate
a bar chart between cancer types and females. whereas, cancers on x-axis and
females on the y-axis.In my dataset list of cancers are in a first column and
females in second column. My code ... |
Handling HTML characters in web scraped html using Python BS4
Question: This might be a duplicate question, but unable to find any answers searching
through stackoverflow..
Scraped some html files from the web, but they contain special characters like
'>', '<' in the text and BeautifulSoup is unable to handle it and t... |
python exception handler to recomend package
Question: I would like to have python recomend a python package in the event of an
import error.
I tried:
except ImportError as e:
sys.exit("'Error: Try sudo pip install %s'" % e)
but this is the output:
'Error: Try sudo pip inst... |
Python-yad Progress Bar not working in python 3.4 but works in python 2.7
Question: I have created a python [interface](https://gitlab.com/dvenkatsagar/python-
yad/blob/2c1fb0379d425fdc5474f1ab4f2fe38219a1ff8d/python-yad/yad.py) for the
[yad](https://sourceforge.net/projects/yad-dialog/) program. What the code
basicall... |
Comments in python don’t work after sublime upgrade to 3103
Question: I just upgraded to Sublime 3103, and now the comment shortcut `command+/` does
not work. This is weird because it doesn't work only in Python. For all other
programming languages, it works just fine.
I tried setting up a custom keybinding for commen... |
Implied volatility calculation in Python
Question: With the comments from the answer, I rewrote the code below
(math.1p(x)->math.log(x)), which now should work and give a good approximation
of the volatility.
I am trying to create a short code to calculate the implied volatility of a
European Call option. I wrote the ... |
appengine python remote_api module object has no attribute GoogleCredentials
Question: AttributeError: 'module' object has no attribute 'GoogleCredentials'
I have an appengine app which is running on localhost. I have some tests which
i run and i want to use the remote_api to check the db values. When i try to
access ... |
How do I count exoplanets per system in a file with over 10,000 lines in Python?
Question: I am working with astronomical data and I need help summarizing it.
My data contains ~10,000 lines, where each line represents a system.
The input file is tab delimited like this: exo sys_planet_count
0 1
... |
Execute python script from within HTML
Question: On my raspberry pi i have apache2 running. i have a very basic image displayed
when you go to the site. What i want to be able to do is, when the image is
clicked i want the following script to run.
import subprocess
subprocess.call('./milight_sources/... |
check if a json file already has the data i am overriding in python
Question: I am currently making a python script that automates a task by sending an
email after first parsing the data from a website then sending the message
from that data using twilio.
But what I want is to first compare the data parsed with the al... |
Getting insecure pickle string with ggplot
Question: I'm trying to use ggplot for Python working inside iPython Notebook, but when
running `from ggplot import *` the following error appears:
---------------------------------------------------------------------------
ValueError ... |
Ford-Fulkerson Algorithm Max flow algorithm - What is wrong with this Java implementation?
Question: I am trying to implement a java version of Ford-Fulkerson. I used the python
implementation from
[wikipedia](https://en.wikipedia.org/wiki/Ford%E2%80%93Fulkerson_algorithm#Python_implementation)
as a basis:
... |
Building a dictionary out of components in a file
Question: I have a file, where in each line, it contains a readname; a '+' or '-'; a
position marked by a number.
I went ahead to first open the file and have in Python script:
#!/usr/bin/env python
import sys
file=open('filepath... |
How to let user select which arg to print
Question: As a way to learn python, I am building Yahtzee.py.
After the first roll, I would like the user to decide what to keep or what to
reroll (up to 3 times).
So as to avoid writing a code for every scenario how can I allow user to
select which dice to reroll. ie( keep d... |
PyGame: Unable to open file
Question: I'm trying some basic examples from the [Making Games with Python &
Pygame](https://inventwithpython.com/makinggames.pdf) book, but I'm facing a
weird problem. Here is the example source:
import pygame, time
soundObj = pygame.mixer.Sound('beep.wav')
soun... |
Python: Extract chapter from long txt (or delete all other chapters)
Question: My problem is: I have several long txt files with many chapters of which I
want to extract one. The text within these chapters differs between files.
Identification should be done using the title of the chapter and the title of
the next cha... |
Python list with Vcenter vm
Question: I found a Python script to list all Vcenter VM attributes, but now I need to
register some of attributes into a Python list (or array, dict... ).
But it doesn't works.
My getVminfos.py :
EDIT : the right file :
import argparse
import atexit
import itertool... |
How to make simple interacting with running python script for web?
Question: I have a running loop script in Python, which I want interact with a HTML-
page. For example:
> (HTML)Clicking button -> magic -> (Python) Do something function in
> script.py
[This response](http://stackoverflow.com/questions/27474557/inter... |
Jupyter install for Python 2.7 failed
Question: I have the Anaconda distribution of Python 2.7 and I needed to install the
Jupyter notebook package. During the installation process my computer turned
off and after that I couldn't continue with the process. I tried to uninstall
Jupyter and try installing it again, but I... |
Python: Creating list of subarrays
Question: I have a massive array but for illustration I am using an array of size 14. I
have another list which contains 2, 3, 3, 6. How do I efficiently without for
look create a list of new arrays such that:
import numpy as np
A = np.array([1,2,4,5,7,1,2,4,5,7,2,8... |
ng-init gives parse error when it finds u' in data received from Django
Question: I am sending some data from the Django backend to the template, where I use
Angular with `ng-repeat` and `ng-init` to loop through the data and print it
on screen.
This is how I get the data in the backend with Python2 and Django:
... |
OpenCV - using VideoWriter gives no file
Question: I have searched for a solution of my problem on many sites (including stack
overflow). I am trying to save a video from my webcam in my Raspberry using
OpenCV. Theoretically, my code works fine (I can see my webcam in the window,
i can see python printing "frame"), but... |
python 2.7 - argument as name to following argument
Question:
import argparse
def add(number_one = 0,number_two = 2):
a = int(number_one) + int(number_two)
return(a)
def Main():
parser = argparse.ArgumentParser()
parser.add_argument("n1", help = "first number", type=flo... |
Having trouble using a C library via a Python API: What am I doing wrong?
Question: I'm using a Python script in conjunction with a thermocouple and a
thermocouple reader. To communicate with the thermocouple reader, which is
written in C, I have to use an API. That API is
[PyDAQFlex](https://github.com/torfbolt/PyDAQF... |
Installing RKernel
Question: Despite all my efforts, I wasn't able to install the R kernel for my
IPython/Jupyter notebook on Canopy.
I've closely followed the clear instructions given in:
<http://www.michaelpacer.com/maths/r-kernel-for-ipython-notebook> (or,
alternatively, <http://irkernel.github.io/installation/>)
... |
python csv importing to link
Question: I am trying to get Python to open sites based on a csv file. I checked all of
my code individually to make sure it worked and it does but when I introduce
this variable from the csv file I am getting the error message below: Here is
the code:
import urllib
impor... |
python object changes the value of an input variable
Question: So I don't know if this is a well-formed question, and I'm sorry if it isn't,
but I'm pretty stumped. Furthermore, I don't know how to submit a minimal
working example because I can't reproduce the behavior without the whole code,
which is a little big for ... |
Python GUI TKinter
Question: I'm making an interface for my e-learning question which is on easy
difficulty. is there anything wrong with the code? It keeps on saying there is
an error on line 21. Whats the mistake?
import Tkinter
MathsEasyLevel1 = Tkinter.Tk()
MathsEasyLevel1.geometry("320x260")... |
class instance as process within kivy app: kivy app gets stuck
Question: I do have an interface to store settings and to start a process. However, I
cannot close everything once the process starts because kivy gets stuck after
calling `process.run`. Here is a minimal example:
#! /usr/bin/env python
... |
Efficient functional list iteration in Python
Question: So suppose I have an array of some elements. Each element have some number of
properties.
I need to filter this list from some subsets of values determined by
predicates. This subsets of course can have intersections. I also need to
determine amount of values in ... |
search for substring in output, then print the line
Question: I would like to list a file and then search the lines for a pattern, like I do
in Bash with.
cat /etc/passwd | grep nologin
I try the following:
#!/usr/bin/python3
import subprocess
CMD=('cat', '/etc/pass... |
how to add a module to Anaconda
Question: This is what i get when i do "**_python -V_** "
**Python 2.7.11 :: Anaconda 2.4.0 (64-bit)** I usually use my terminal to play
with IDLE.But now i have also installed IDLE shell.
I tried _import sys;sys.path_ on both.They throw different paths. My Terminal
returned the path w... |
AttributeError: 'module' object has no attribute 'Sframe'
Question: I installed Dato's `GraphLab Create` to run with `python 27` first directly
from its executable then manually via `pip` ([instructions
here](https://dato.com/products/create/)) for troubleshooting.
Code:
import graphlab
graphlab.SFr... |
Getting correct exogenous least squares prediction in Python statsmodels
Question: I am having trouble getting a reasonable prediction behavior from [least
squares
fits](http://statsmodels.sourceforge.net/devel/generated/statsmodels.regression.linear_model.WLS.html)
in `statsmodels` version 0.6.1. It does not seem to b... |
Scraping Google images with Python3 (requests + BeautifulSoup)
Question: I would like to download bulk images, using Google image search.
My first method; downloading the page source to a file and then opening it
with `open()` works fine, but I would like to be able to fetch image urls by
just running the script and c... |
Possible to add numpy arrays to python sets?
Question: I know that in order to add an element to a set it must be hashable, and numpy
arrays seemingly are not. This is causing me some problems because I have the
following bit of code:
fill_set = set()
for i in list_of_np_1D:
vecs = i + np_2D
... |
Converting NBA play by play specific .json to .csv
Question: I am trying to build a database containing play by play data for several
seasons of NBA games, for my Msc. in economics dissertation. Currently I am
extracting games from the NBA's API ([see
example](http://stats.nba.com/stats/playbyplayv2?GameID=0041300402&S... |
Python: Generate matrix of Nx4 integers who sum is a constant
Question: I have search the web which has provided various solution on how to produce a
matrix of random numbers whose sum is a constant. My problem is slightly
different. I want to generate an NX4 matrix of exhaustive list of integers
such that sum of all n... |
How to add a variable of a method of a class in aonther program in python?
Question: I have a class called WIFISegment as below in ns3.py :
class WIFISegment( object ):
"""Equivalent of radio WiFi channel.
Only Ap and WDS devices support SendFrom()."""
def __init__( self ):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.