0 answers

list index is out of range - cannot find why

I'm writing code to sort data into lists and then arrange these lists, but I keep getting: builtins.IndexError: list index out of range The data in the code is: Class 1: Matthew 5 5 1 Paul ...

0 answers

random instances of map-coloring in python

I need to generate random instances of map coloring problem in python to implement a min-conflict solver. I should follow this strategy: scatter n points on the unit square; select a point X at ...

0 answers

lookalike in a features space using sklearn

I am looking for an idea to implement a lookalike alogrithm. Let me give more details. I have a features space with 100 features. I have a total of 100000000 samples (space A), and a subspace S of A ...

0 answers

Does setting numpy arrays to None free memory?

I have hundreds of really larges matrices, like (600, 800) or (3, 600, 800) shape'd ones. Therefore I want to de-allocate the memory used as soon as I don't really need something anymore. I thought: ...

1 answer

Erase ram space used by variable in python, prevent memory dump attack

Looking for a verified solution for this problem in python. I have code like this verySensitveData = "secret, big secret" #useing verySensitveData in code #not need it any more del verySensitveData # ...

1 answers | 3 mins ago by nkvnkv on Stack Overflow stackoverflow.com
1 answer

What is the best way to display a videostream in PyQt4?

I have a server that constantly sends out a video stream. It's just a constant stream of images actually. I can display this stream in my browser by loading the following html page: <!DOCTYPE ...

1 answers | 4 mins ago by user2443088 on Stack Overflow stackoverflow.com
2 answers

python serial data - incoming data according to previous line result

I receive data from serial (pyserial) line by line. Is it possible to put a condition for each new incoming line according to the previous line result ? exemple : data3 == int(incoming_data_serial) ...

2 answers | 4 mins ago by pythonrocks on Stack Overflow stackoverflow.com
2 answers

Python script using spark library at Bluemix

I am trying to write python script to call spark library at Bluemix platform. Would you mind advise the flow? I have created Apache Spark Analytic Service at Bluemix, and open a iPython Notebook. ...

2 answers

Get canvas coordinate of every pixel of a tkinter canvas line created with a known width

I would like to get the canvas coordinate of every pixel of a line that is drawn with a given width in tkinter canvas. There was a previous post on this question and the answer given is that it is ...

1 answer

Django FormWizard. Need to set_password

I am trying to use FormWizard to make a registration for new users. I currently have a problem with passing password after all validations is done. I tried to do it numerous ways, but always get an ...

0 answers

how to check variable values and list in python?

How can I execute just a section of my Python code? For example in MATLAB we can select a part and by F9 we can run that section several times. But in Python it seems the variable values are not ...

2 answers

How to register multiple fields from a loop in a forms?

How can I do to record responses to questions by looping ? I possess several questions and I would answer all powers at the same time creating a loop that gets me every I can create a loop for each ...

1 answer

Python 3 - travel directory tree with limited recursion depth

I need to process all files in a directory tree recursively, but with a limited depth. That means for example to look for files in the current directory and the first two subdirectory levels, but ...

1 answer

text classifier with bag of words and additional sentiment feature in sklearn

I am trying to build a classifier that in addition to bag of words uses features like the sentiment or a topic (LDA result). I have a pandas DataFrame with the text and the label and would like to add ...

3 answers

Count the frequency of a recurring list — inside a list of lists

I have a list of lists in python and I need to find how many times each sub-list has occurred. Here is a sample, from collections import Counter list1 = [[ 1., 4., 2.5], [ 1., 2.66666667, ...

0 answers

Getting warnings in opencv when using VideoCapture

When I run this code to play a video using cv2 import cv2 cap = cv2.VideoCapture('video.mp4') while(cap.isOpened()): ret, frame = cap.read() gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) ...

2 answers

Get a list of all possible binary tuples with length n

I need a function which returns a list of all possible binary tuples with length n, like this: binaryTuples(n=2) => [(0,0),(0,1),(1,0),(1,1)] binaryTuples(n=3) => ...

2 answers | 11 mins ago by vicco on Stack Overflow stackoverflow.com
0 answers

Invensense Motion Driver 6.12 STM32 demo python don't work

I am trying to run the Invensense motion_driver_6.12. I compiled the code with IAR and the STM32 works ok - all the test I've done with the board are ok: UART, I2C.. etc. But when I run the python ...

2 answers

set a pandas datetime64 pandas dataframe column as a datetimeindex without the time component

After importing data from a HDF5 file the index for my stock data has disappeared. One of the columns in my dataframe "Date" is a Datetime64. How do I convert this date column to a datetimeindex ...

2 answers | 14 mins ago by yoshiserry on Stack Overflow stackoverflow.com
1 answer

Delete Rows in pandas dataframe

I want to delete some rows in a pandas DataFrame. id marks 1 123 45 2 124 67 3 127 89 4 257 10 5 345 34 delRows = [123,127] output should be - id marks 2 124 67 4 257 10 ...

1 answers | 14 mins ago by maggs on Stack Overflow stackoverflow.com
1 answer

How to solve conda update --all resulting “Unsatisfiable package specifications” error

This is the error I'm getting I did as the thing suggested and got out the info on the installed versions of pykit and bottleneck. Here is pykit: Here is bottleneck: I figured, pykit uses ...

1 answers | 14 mins ago by kchak on Stack Overflow stackoverflow.com
1 answer

How to calculate a rolling mean from a series of dates spanning years?

I have a CSV file containing stock data spanning 10 years. How do I find the rolling mean of those dates using Pandas? I've tried: pd.rolling_mean(df.resample("1D", fill_method="ffill"), window=3, ...

1 answers | 14 mins ago by template boy on Stack Overflow stackoverflow.com
3 answers

Specific Fields python

I try to select specific fields from my Qdata.txt file and use field[2] to calculate average for every years separate. My code give only total average. data file looks like: (1. day of year: 101 and ...

3 answers | 14 mins ago by tropicneo on Stack Overflow stackoverflow.com
1 answer

What is the good way to organize a long list in a model?

Here's how I declare my choice fields: class Personne(models.Model): NIVEAU_ETUDE_PETITE_ENFANCE = u'0' NIVEAU_ETUDE_PRIMAIRE = u'1' NIVEAU_ETUDE_SECONDAIRE_1ER_CYCLE = u'2' ...

3 answers

Python calculate lots of distances quickly

I have an input of 36,742 points which means if I wanted to calculate the lower triangle of a distance matrix (using the vincenty approximation) I would need to generate 36,742*36,741*0.5 = ...

1 answer

Python; Matplotlib: Set boundaries of Bins to integer values

I m drawing a histogram with matplot and I m wondering whether it is possible to set set boundaries of each bin to an integer value. Because if I interpret the Output values of my Plotting correctly ...

1 answers | 16 mins ago by Alanovic on Stack Overflow stackoverflow.com
2 answers

Fit a non-linear function to data/observations with pyMCMC/pyMC

I am trying to fit some data with a Gaussian (and more complex) function(s). I have created a small example below. My first question is, am I doing it right? My second question is, how do I add an ...

2 answers | 16 mins ago by magnusvp on Stack Overflow stackoverflow.com
1 answer

Capture c++ shared library log entries with ctypes

I have a cplusplus shared library, with a c interface, that writes log entries in stdout. I'm using it in a python application using the ctypes library. The python application uses logging library to ...

1 answers | 16 mins ago by eguaio on Stack Overflow stackoverflow.com
1 answer

Python Matplotlib How to plot a line chart in weekly intervale

I am working in a project where I need to plot data and into a line chart. The problem is that i don't have the X values i have just the Y values here is the list of the value that i want to plot : ...

3 answers

How to remove '1' from array elements that reads from a txt file python

This is the out put that comes [['8' '4' '2'] ['7' '6' '1'] ['6' '8' '1']] [['87'] ['70'] ['68']] i want output as this one [[ 8 4 2] [ 7 6 1] [ 6 8 1]] [[ 87 ] [ 70 ] [ 68 ]] ...

15 30 50 per page
1 2 3