text stringlengths 226 34.5k |
|---|
Django Basics myapp mapping in myproject "myapp" is not defined
Question: I am learning django, and have ran `python manage.py startapp myapp` which
created the following folder structure:
myapp/
__init__.py
admin.py
models.py
tests.py
views.py
I also added `myapp... |
Get higher resolution pygame
Question: I am trying to make a game in python and pygame. I want to make a game with
decent resolution, but I can't get higher resolution, any ways?
import pygame
import time
import random
import os
pygame.init()
height = 600
width = 800
wind... |
Refer to defined variable from function outside Python class
Question: Excuse for newbie question but I want make all clear for myself. I have a
problem accessing class variable from within function outside the class. In
code below I need **`text, text2`**. I get variables as tuple but I need them
separately. How to up... |
RuntimeError while opening deploy.prototxt
Question: I'm trying run a simple code with caffe that should open `deploy.prototxt` but
it couldn't open the file and throws this error
RuntimeError: Could not open file /home/ebadawy/git/caffemodels/bvlc_reference_caffenet/deploy.prototxt
this is my code... |
NameError says variable is not defined, but only in some places
Question: I am trying to implement a keep-alive that sends some data every 30 seconds to
keep a telnet connection open.
My code calls `reinitScore` every second. This function will sometimes call
`calculateWinner`, which sends the data through telnet via
... |
What's a simple way to build a python web service which will take arguments and return a value?
Question: I want to write a simple python web service which will read the arguments
provided in the called url and based on that return some basic string.
In order to get started and get a better understanding of the whole ... |
Identifying false alert using python mapreduce
Question: Can someone help me regarding the following problem. I am trying to analyze a
security log to find false alerts. The false alerts are those containing "TXT
was not created" and true are with "txt was not created". How can I extract
the particular "txt was not cre... |
Split one txt to several txt files with particular name in Python
Question: I have a txt file which looks like:
24.03.2016 Peso
27.03.2016 Ruble
18.04.2016 Euro
17.05.2016 Dollar
16.06.2016 Frank
I need to split it in different files, and the name of a new file should be
the d... |
incrementing values of a list at specific indexes python
Question: I am attempting to create a list for each nucleotide (A, G, C, T) in a
sequence where the index of the list corresponds to the position in the
sequence and the value is the frequency of that nucleotide across all
sequences, here are 4 sequences as an ex... |
Is there a Python class/enum for flag/bit mask operations?
Question: I know of base classes `Enum` and `IntEnum`. Both are very helpful but I miss
features for flag operations. I don't expect that these two classes implement
my wished feature.
Let's construct an example:
class NetlistKind(IntEnum):
... |
Python3 Unicode Decode Error
Question: I get `UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 0:
invalid continuation byte`
When I try to call `codecs.decode(X, 'utf-8')` where `X =
b'\xe8\xd0\xca@\xee\xe4\xca\xc6\xd6@\xde\xcc@\xe8\xd0\xca@\xd0\xca\xe6\xe0\xca\xe4\xea\xe6\x14\xc4\xf2@\xd0\xca\xdc\... |
Can I force python array elements to have a specific size?
Question: I am using the arrays modules to store sizable numbers (many gigabytes) of
unsigned 32 bit ints. Rather than using 4 bytes for each element, python is
using 8 bytes, as indicated by array.itemsize, and verified by pympler.
eg:
>>> arra... |
IV must be 16 bytes long error in AES encryption
Question: I am using [pycrypto](https://pypi.python.org/pypi/pycrypto) module for AES
encryption. And using documentation I have write down the below function but
it al;ways gives error `IV must be 16 bytes long` but I am using 16 byte long
IV.
def aes_enc... |
MySQL queries waiting for other queries to finish
Question: We have 30-40 different projects in Python and PHP that update, insert and
select more than 1 million rows of data in MySQL DB every day.
Currently we use InnoDB Engine for our tables.
The problem: we have peaks in MySQL when almost all projects are working ... |
Errno 13 when installing python package
Question: I'm pretty new to programming and I've just downloaded Ubuntu onto my laptop.
The problem I'm having is when I try to install the python package tabulate
(<https://pypi.python.org/pypi/tabulate>) from the terminal it displays an
error telling me I don't have permission ... |
Compare rows of csv and work out percentage
Question: I'm relatively new to Python. I'm trying to find a way to create a script that
looks at a CSV file called "data_old" from a previous month, and compares it
with the data in a more recent month called "data_new", then finally outputs
that data into a new CSV "data_co... |
How to run python script on Jupyter in the terminal?
Question: I want to execute one python script in Jupyter, but I don't want to use the
web browser (IPython Interactive terminal), I want to run a single command in
the Linux terminal to load & run the python script, so that I can get the
output from Jupyter.
I tried... |
How can I form a composite Function with Theano?
Question: I would like to compute a composite function f(x, g(x)) with Theano.
Unfortunately, when I try to code a function composition, Python complains
about a TypeError. For example, consider the following simple script:
import theano
import theano.... |
Value Error: Too many dimensions: 3 > 2
Question: I've tried to resize image with scipy and everything seems to work fine until
I try to save the image. When I try to save image I get error that you can see
in title. Full traceback is available below.
import numpy as np
import scipy.misc
from PIL... |
Replace value in array when greater than x
Question: I get a little problem with a simple idea. I have an array of data and I would
like to replace each value if the value is greater than X.
To solve that, I wrote a little script as example which give the same idea :
import numpy as np
# Array ... |
ImportError: DLL load failed: The specified module could not be found for numpy
Question: I have Python 3.3.2, 64 bit. When I run a script with `import numpy` I get the
following Error: `ImportError: DLL load failed: The specified module could not
be found.`. The traceback is:
Traceback (most recent call... |
what does "*" mean in the following line in python?
Question: I was looking for the graphical interface using python.
what does * means in the following line ?
=======
from Tkinter import *
Answer: [What exactly does "import *"
import?](http://stackoverflow.com/questions/2360724/what-exactly-do... |
Python 2.6.4 - method name is not defined
Question: Running a python script named `automator.py` from the command line using
powershell on windows 7.
`python .\automator.py`
`automator.py` file looks like this....
import os
ipAddressFile = os.path.join("DCM_Info", "ip_address")
ipAddresses... |
Selecting values from list in dictionary python
Question: I've been working on a small contact importer, and now I'm trying to implement
a block that automatically selects the output file format based on the number
of contacts to be imported.
However, every time it results in the error:
KeyError: 'q'
... |
Vectorizing for loop with repeated indices in python
Question: I am trying to optimize a snippet that gets called a lot (millions of times)
so any type of speed improvement (hopefully removing the for-loop) would be
great.
I am computing a correlation function of some j'th particle with all others
C_j(|r-r'|) = sqrt(... |
Convert csv to json with python
Question: everyone, I tried to convert my csv to json, using the code below:
f = open( 'D:\\ResumesClassification\\test2.csv', 'r' )
fieldnames =("id","basicinformation","workexperience","education","skill","publication","add tionalinformation","link","award","certific... |
Django/Python timestamp convert EDT to UTC
Question: I have a Python datetime object and here is the offset and tzname(). As in
Django, the timezone is stored as UTC, I want it store the the tzname
separately, so that I can use that field to reconvert to the actual datetime.
>>>from dateutil.parser impor... |
Python Rate Limit class based view Flask
Question: I'm following this example:
<http://flask-limiter.readthedocs.org/en/stable/#ratelimit-string>
app = Flask(__name__)
limiter = Limiter(app, key_func=get_remote_address)
class MyView(flask.views.MethodView):
decorators = [limiter.lim... |
Xpath python is not working
Question: hi i am trying to get data from xxx website through python xpath...it just
give me blank data.. i copied the xpath from chrome.. pls let me know what i
am doing wrong here. Thanks you
from lxml import html,etree
import requests
import urllib2
def webText(... |
Check if element returned by xpath is correct
Question: I am making my first Python project. I am trying to scrape a web page like
this:
page = requests.get('http://www.mypage.com')
tree = html.fromstring(page.content)
table = tree.xpath('//table[@class="list"]')
However, I'm not sure if th... |
Can't launch selenium tests inside container, WebDriverException:Chrome failed to start: exited abnormally
Question: My problem is - I can't launch selenium tests inside container.
my docker file looks like:
FROM selenium/node-chrome
EXPOSE 9090
USER root
RUN mkdir /code
... |
Can not get table header elements
Question: In Python, I have a variable containing an `html` table element obtained like
this:
page = requests.get('http://www.myPage.com')
tree = html.fromstring(page.content)
table = tree.xpath('//table[@class="list"]')
The `table` variable has this conten... |
Call predict function for nearest neighbor (knn) classifier with Python scikit sklearn
Question: I've tried to call predict function of nearest neighbor and got the following
error:
AttributeError: 'NearestNeighbors' object has no attribute 'predict'
The code is:
from sklearn.neighbo... |
Egg and basket game in python
Question: I am a beginner in python programming. I got a course project to make a game
using python. I tried making the egg and basket game using pygame. The game is
working to some extent. I am able to make the egg fall and move the basket on
key press, but I am not able to make egg fall ... |
How to extract the rating of a movie in imdb from an image element using scrapy in python
Question: I am trying to scrape imdb using pythons scrapy. however I am not being able
to get the rating info from the page as shown below:
[image](http://i.stack.imgur.com/6OnEM.png)
I am using the below code:
fr... |
Django - Foreman cannot find installed modeles
Question: I am trying to use [Foreman](https://github.com/ddollar/foreman) /
[Honcho](https://github.com/nickstenning/honcho) to manage my Procfile-based
Django application. When I start the app view the normal `python manage.py
runserver`, everything works fine. However, ... |
Importing CSV from URL and displaying rows on Python by using Requests
Question:
import csv
import requests
webpage = requests.get('http://www.pjm.com/pub/account/lmpda/20160427-da.csv')
reader=csv.reader(webpage)
for row in reader:
print(row)
Hi, I'm new to Python and I'm trying to o... |
Django - env folder not getting created while using VS 2015 and python 2.7
Question: I am using VS 2015 and python 2.7 to create a Web application using Django. VS
2015 asked to create a virtual env but I am getting the following error and
the env folder is not getting created;
Installing 'pip' package m... |
How to append a new column to a CSV file using Python?
Question: I have stored a set of four numbers in an array which I want to add to a CSV
file under the 'Score' column.
with open('Player.csv', 'ab') as csvfile:
fieldnames = ['Score']
writer = csv.DictWriter(csvfile, fieldnames=fieldna... |
Python Heads and Tails
Question: I need help for a Python game I am currently creating. When running the code
it will stay open and do nothing after entering a number of times to flip.
Here is what I have so far:
# Heads and Tails generator
# User how many times they wish to flip a coin and will reci... |
How do I return JSON-data from python to javascript?
Question: I'm working on a pythonfile which returns the variable "distance" and sends it
to a javascriptfile where I can put the value on my webpage.
My problem is that I don't know how to send the value from python to
javascript. I've heard you have to make the pyt... |
How to get url from a new window by using Selenium with phantomjs
Question: I want to get a new window url by using selenium, and using PhantomJs is more
efficient than Firefox. python code is here:
from selenium import webdriver
renren = webdriver.Firefox()
#renren = webdriver.PhantomJS()
re... |
Amazon S3 and Cloudfront - Publish file uploaded as hashed filename
Question: **Technologies:**
* Python3
* Boto3
* AWS
I have a project built using Python3 and Boto3 to communicate with a bucket in
Amazon S3 service.
The process is that a user posts images to the service; these' images are
uploaded to an S3 ... |
Automatically detect identical consecutive std::string::find() calls
Question: During a code review, i found source code like this:
void f_odd(std::string &className, std::string &testName)
{
if (className.find("::") != std::string::npos)
{
testName = className.substr(className... |
Flask route to download .xml files leading to 404 Not Found
Question: I have a `flask` (0.10.1) app running on a `Debian Jessie VPS` and powered by
`nginx` (1.6.2). The app is working fine but I have a problem on a specific
`route` I added recently.
The `route` is intended for downloading `.xml` files.
It is dynamic ... |
Row into column in Python
Question: I have a CSV file containing a time serie of daily precipitation. The problem
arises of how the data is organized. Here a small sample to ilustrate:
date p01 p02 p03 p04 p05 p06
01-01-1941 33.6 7.1 22.3 0 0 0
01-02-1941 0 0 1.1 11.3 0 0
So, there... |
DeprecationWarning in sklearn MiniBatchKMeans
Question:
vectors = model.syn0
n_clusters_kmeans = 20 # more for visualization 100 better for clustering
min_kmeans = MiniBatchKMeans(init='k-means++', n_clusters=n_clusters_kmeans, n_init=10)
min_kmeans.fit(vectors)
X_reduced = Truncated... |
H2O python rbind error
Question: I have a 2000 rows data frame and I'm trying to slice the same data frame into
two and combine them together.
t1 = test[:10, :]
t2 = test[20:, :]
temp = t1.rbind(t2)
temp.show()
Then I got this error:
--------------------------------------... |
Multi-dimension dictionary in configparser
Question: Is it possible to store a multi-dimensional dictionary (3 deep) using the
Python 'configparser' using indentions? The work-around is to split the key
values, but wanted to know if there was a clean way to import directly into a
dictionary.
**DOES NOT WORK - USING SU... |
A way to set up virtual environment directly in Eclipse for Django project?
Question: Is there a way to have Eclipse directly set up a virtual environment for
Django? I can create one independently and import into Eclipse but wondering
if there is a way to have Eclipse/PyDev set one up internally? Using Python
2.7 and/... |
Sending data from Python to R to perform statistical test using rpy2
Question: I want to use the [Fisher's exact test
functionality](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/fisher.test.html)
(specifically, the MC simulation functionality) of R with an interface to
Python. I'm trying to do that using
[r... |
Hadoop returning less results than expected
Question: I have two python scripts a mapper and reducer (basically reducer at this
point just prints nothing else) and while locally i get 4 results - strings on
hadoop i get 3. How does this work?
i use Amazon Elastic Map Reduce using Hadoop
mapper.py
#!/us... |
Fitting an exponential modified gaussian curve to data with Python
Question: I have a data set and a kernel density estimate for those data. I believe the
KDE should be reasonably well described by an [exponentinally modified
Gaussian](https://en.wikipedia.org/wiki/Exponentially_modified_Gaussian_distribution),
so I'm ... |
Ansible correct way to get a virtualenv with a recent version of setuptools and pip
Question: Hello today to get a virtualenv runing with vagrant (1.7.4)
I first install `python-virtualenv` with apt::
- name: Apt install
apt: name={{ item }} state=installed update_cache=yes
with_items:
... |
Python quit unexpectedly
Question: Can anybody help with this? Whenever I try to launch tkinter, i get this
report:
> Process: Python [1106] Path:
>
> /Library/Frameworks/Python.framework/Versions/3.5/Resources/Python.app/Contents/MacOS/Python
> Identifier: org.python.python Version: 3.5.1 (3.5.1) Code Type: X86-64
... |
faster geometric average on ASCII
Question: Is it possible to speed up the following code, but without using external
modules (NumPy, etc)? Just plain Python. Two lines of thought: speeding the
computation in
chr(int(round( multiplOrds**(1.0/DLen), 0) ) )
or faster building of the desired structure... |
Exception django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet
Question: I have upgraded django version from 1.8 into 1.9 and django rest framework to
3.3.3. I am getting this exception:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
I have tried as follows but exception is still the... |
values at coordinates to image
Question: I have a text file with measurement data which looks like this.
x y z
1 3 -2
2 1 -3
3 1 1
2 2 3
1 2 2
2 3 0
This would imply the following measurement (on an x,y grid)
-2 0
2 3
... |
Python: How to add content of file to list from position
Question: I have a JSON file containing various objects each containing elements. With
my python script, I only keep the objects I want, and then put the elements I
want in a list. But the element has a prefix, which I'd like to suppress form
the list. The post-s... |
importing swift file to obj-c
Question: Okay, this one is too much for me. I'm trying to import manually file from
socket-io which are written in swift, to my project who is fully written in
obj-c.
I have read the doc from [Swift and
obj-c](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Buildin... |
Apply power fit to data by using levenberg-marquardt algorithm in python
Question: Hy everybody! I am a beginer in python and data analysis, and meet with a
problem, during fitting a power function to my data. [Here I plotted my
dataset as a scatterplot](http://i.stack.imgur.com/V173w.png)
I want to plot a power funct... |
Flask-Python import data from csv file
Question: I am trying to import a csv file from a webpage using flask. I am able to
import the data from the csv file and return the data as json. However, I
would like to print only the first sample from the data. I have attached my
code and the flask error below. The csv file I ... |
Python cannot load cx_Oracle on Windows 7
Question: I installed python-2.7.amd64.msi and cx_Oracle-5.1.2-11g.win-amd64-py2.7.msi.
I've poked around a lot with PATH and PYTHONPATH environment variables but
nothing has helped loading the cx_Oracle module. Currently PYTHONPATH is set
to C:\Python27\Lib\site-packages
My ... |
How to do configuration of a python environment
Question: During the last years I mostly used django. Django uses the environment
variable `DJANGO_SETTINGS_MODULE` to find its configuration.
Now I have a project where I don't use django and I would like to have a clean
and easy to understand way to load the configurat... |
How to change the point size for regplot(), seaborn's scatter plot function (python)
Question: I want to be able to set the point size when plotting like this:
sns.regplot(y=[1,3,4,2,5], x=[range(5)], data=df,
marker='o', color='red')
plt.show()
Do you guys know how?
Answer: T... |
Python Classes order of executing things
Question: I'm trying to make a window full of balloons disappear one-by-one (clicking on
it),using python2, but I'm a little confused where I could capture my mouse
events, in this moment, I'm not clicking anything, the code is attached. I'm
inspired by the code at: <http://effb... |
Plot pandas dataframe with varying number of columns along imshow
Question: I want to plot an image and a pandas bar plot side by side in an iPython
notebook. This is part of a function so that the dataframe containing the
values for the bar chart can vary with respect to number of columns.
The libraries
... |
Calculating vectors with the cosine law (Python)
Question: I was trying to develop a little console aplication for solving additions
between vectors using the Cosine Law:
sum = sqrt((s1 ** 2) + (s2 ** 2) + (2 * s1 * s2 * cos(angle)))
print(sum)
`# Where s1 and s2 are the sizes of the vectors, r... |
Parsing Text with Python RegEx re.findall
Question: I have a long string that I need to parse in groups, but need to control it
more.
import re
RAW_Data = "Name Multiple Words Testing With 1234 Numbers and this stuff* ((Bla Bla Bla (Bla Bla) A40 & A41)) Name Multiple Words Testing With 3456 Numb... |
Python Rearrange & remove character from html page title
Question: I'm running Python 2.7.11 | on Windows 10 using beautifulsoup4 and lxml.
import urllib2
import re
from bs4 import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen("http://www.daisuki.net/us/en/anime/watch.GUNDAMUNICORNRE... |
Calling variables in another module python
Question: I'm trying to access variables I created in one function inside another module
in Python to plot a graph however, Python can't find them. Heres some example
code:
class1:
def method1
var1 = []
var2 = []
#Do somet... |
pylab.show() did not work
Question: I run the python code as it is from this website:
<http://cvxopt.org/examples/book/rls.html>
To show it here:
# Figure 4.11, page 185.
# Regularized least-squares.
....
pylab.figure(1, facecolor='w')
pylab.plot(lbnds, alpha1, 'b-', u... |
How can I add all the images in a directory to a word document using Python
Question: I have been trying to make this code work so I can add hundreds of pictures
into a microsoft word document but can't quite get it to work. I think the
problem is in defining the location of the images correctly.
import ... |
Python checking a Entry isn't working
Question:
__author__ = "Jack Ashton"
from tkinter import *
import random
window = Tk()
canvas = Canvas(window, width=800, height=600, background="dark cyan")
canvas.pack_propagate(False)
placeholder = StringVar
#----------------------... |
how to write a multithread kivy game(on rasp Pi) that can listen to a port at the same time
Question: I am writing a remote-control snake game on Raspberry Pi using kivy(output to
the 7" display). The socket is supposed to listen to the port while the game
is running. However it turns out that game loop and socketIO's ... |
Unable to see widgets on second window after successful login. Python and PyQt4
Question: There are two classes for two windows. Upon successful login it should launch
MainWindow. Code is able to launch MainWindow. But does not show any widgets
on it. There are two catergories of users: 1) admin 2) Other user I want to... |
subprocess.CalledProcessError In python when using unrar
Question: Python IDLE shows an error when I am trying to extract files using
winrar(UnRAR.exe):
"Traceback (most recent call last):
File "<pyshell#32>", line 1, in <module>
response=subprocess.check_output(['"C:\\Users\\B74Z3\\Desktop... |
Method returns blank even though it isn't blank inside method
Question: I have written a small scrip (this is partial), the full code should search a
bunch of .c files and check if the parameters within it are being used or not.
This particular code is responsible for grabbing the parameter from a row, so
it can be use... |
Distributing a Python script to unpack .tar.xz
Question: Is there a way to distribute a Python script that can unpack a .tar.xz file?
Specifically:
* This needs to run on other people's machines, not mine, so I can't require any extra modules to have been installed.
* I can get away with assuming the presence of... |
Python click module for creating a CLI
Question: I am using python click module to create a CLI. The fact is that I want to
have category commands with arguments, for example:
myawesomecli env info
myawesomecli env clean
myawesomecli env ...
myawesomecli database create-table <name>
... |
Python BeautifulSoup doesn't works on URL
Question: I'm happy to join Stack Overflow :) First time i don't find an answer at my
problem :)
I would like to scrap "meta description" on url list (in a SQL data base).
When I started my script, it gets "killed" without any error. It gets killed
reading the 11th URL.
I ma... |
How can I fit images with different resolutions?
Question: How can I fit and then overlay 2 images which have different resolution ?
This is the main image: 
I have this one, which has the correct mesh to the image above:

logger.addHandler(... |
python: Multiple plotting in one subplot2grid-image
Question: Let f be a function that depends on an independent variable x and on one (or
more) parameter b. My goal is to draw f for several values of b into the same
image. And I want that b is a global value (so that I can quickly change it).
Consider the code
... |
Selecting specific elements that contain a certain word from a list in python
Question: I want to do a sentiment analysis, but only want to use elements of a list
that contain a certain word. It's about comments and I only want to analyse
the comments that
For example, my list is:
comments = ["nice blog... |
I can't get my python turtle to work
Question: Every time i put import turtle it always comes this
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
import turtle
File "C:/Users/Notandi/AppData/Local/Programs/Python/Python35-32\turtle.py", line 2, in <module>
... |
How do I apply a function to all items in a list in a text or csv file with Python?
Question: So I've built a function that will look through all the xml files in a folder,
and look for a node attribute (speaker name) and write to a row in a csv file.
Note, at the moment, it appends them all to the same csv file, but I... |
How do I deploy a function in python with its dependencies?
Question: I'm trying to use the `serverless` framework to create and deploy an AWS Lamba
function. I created a folder named `vendored` in the root of the project and
installed (using `pip install`) the function dependencies. However, whenever I
try to run it (... |
Python - multithreaded sockets
Question: From my understanding python can only run 1 thread at a time so if I were to
do something like this
import socket, select
from threading import Thread
import config
class Source(Thread):
def __init__(self):
self._wait = False
... |
Python Regex over list of strings
Question: I'm trying to extract a url from a list of strings. Sample list:
import re
p = ['<img class="alignnone size-full wp-image-2087" src="http://www.sample.com/test.jpg" alt="0wCR41v" width="540" height="720" srcset="http://www.sample.com/test-225x300.jpg 225w, ... |
From text to K-Means Vectors input
Question: I've just started diving into Machine Learning, specifically into Clustering.
(I'm using Python but this is irrelevant) My goal is, starting from a
collection of tweets (100K) about fashion world, to perform KMeans over their
text.
Till now I've filtered texts, truncating s... |
no need of name mangling for another object of the same class in python?
Question: I'm new to Python learning about name mangling(double underscore), I've done
my search and learned, but I have one question and couldn't get the answer
through searching: we don't need name mangling when dealing with another
object of th... |
Command glossary for dataflow?
Question: I'm experimenting with the Dataflow Python SDK and would like some sort of
reference as to what the various commands do, their required args and their
recommended syntax.
So after `import google.cloud.dataflow as df`
Where can I read up on df.Create, df.Write, df.FlatMap, df.C... |
Python defaultdict with string as type of value
Question: Need to create a defaultdict, value type is normal Python string, it seems my
below method does not work? Post compile error message. Using Python 2.7 and
wondering any good ideas how to fix? Thanks.
**Code**
import collections
a = colle... |
Python: Deleting a list element based on elements from another list
Question: I have two lists here. I am shuffling list `i`, checking it's first element
and then deleting the corresponding element from list `j` e.g. if after a
shuffle, `i[0] == 3`, then i want to delete element 3 from list '`j`'.
i = ['... |
How do I export a two dimensional list in Python to excel?
Question: I have a list that looks like this:
[[[u'example', u'example2'], [u'example', u'example2'], [u'example', u'example2'], [u'example', u'example2'], [u'example', u'example2']], [[5.926582278481011, 10.012500000000001, 7.133823529411763, 8.... |
Multiprocessing in python, multiple process running same instructions
Question: I'm using multiprocessing in Python for parallelizing. I'm trying to
parallelize the process on chunks of data read from an excel file using
pandas.
I'm new to multiprocessing and parallel processing. During implementation on
simple code,
... |
Python, looking to extract values from a masked array, then rebuild an array
Question: I’m currently writing something that involves a lot of noise I’m attempting to
remove, but in order do this I initially used masks, but the way in which I’m
analysing the data breaks using a mask.
The masking is done, I’m looking to... |
Install/import sklearn module on Spyder 2.1? (Ubuntu)
Question: I am trying to import the sklearn module into `Spyder 2.1 (for Python 2.7)`. I
have installed it on `Anaconda` through the terminal, but when I try to import
it from the console in `Spyder` I get this error:
> ImportError: No module named sklearn.linear_m... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.