Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.

learn more… | top users | synonyms (2) | python jobs

0
votes
0answers
3 views

How to use strip() on to array slice without storing in temporary array

I have at data that looks like this: Probes FOO BAR 1452463_x_at 306.564 185.705 1439374_x_at 393.742 330.495 1426392_a_at 269.850 209.931 1433432_x_at 636.145 487.012 ...
0
votes
0answers
5 views

error when installing numpy for pypy2.2.1

I am trying to use pypy. My python scripts are using numpy. So when I used pypy 1.9.0 it showed me this: "The 'numpy' module of PyPy is in-development and not complete. " ImportError: The '`numpy' ...
0
votes
0answers
12 views

Runninmg python script with c#.net

I have written the following code and I am getting no module named fcntl when i am running the python script using C# print "hi how are you" import nltk a="hi how are you" ...
0
votes
1answer
8 views

How to find out in which locale it was encoded to?

I have one byte class object and I need to convert it into string. I used .decode("format") method (format = UTF-8, latin-1, UTF-16. etc) First I want to know that in which locale it is encoded so ...
0
votes
0answers
6 views

alembic revision - multiple heads (due branching) error

I've got an application build on flask and I wanted to create a new migration for it today. When I run $ alembic revision -m "__name__" I got a message Only a single head is supported. The script ...
0
votes
0answers
7 views

error command gcc failed with exit status 1

I am having trouble installing gcc. Apparently I need gcc 4.0 in order to install a python package. it gives the error of : error: Command "gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc ...
0
votes
5answers
21 views

Returning the first index of an element in a vector in C++

I am trying to find the first index of an element in a vector in c++. Let's say you have a vector: [2, 3, 4, 2, 6, 7, 1, 2, 6, 3]. I would like to find the position of the number 6. So the first ...
1
vote
1answer
4 views

getting the unique values of every column in a pandas dataframe - to help me create smaller more manageable dataframes to perform metrics on

I started off wanting to turn a column from a pandas dataframe into a list, and then get the unique values, with the aim of iterating over those unique values in a for loop, and creating a few smaller ...
0
votes
3answers
26 views

How to read a text file into a 9x9 matrix?

I'm having difficulty with this issue, so I'll describe my problem. I have a text file that contains 81 elements, but 1 column, i.e. it's a 81x1 matrix file. The actual elements are irrelevant. The ...
1
vote
0answers
12 views

Greedy algorithm in Python

I want c in plunder(aList, c) to equal 0. List = [('Gold', 10, 500), ('Silver', 5, 200), ('Diamond', 2, 2000), ('Platinum', 20, 1000)] aList = sorted(List, key = lambda x : x[2]) # sort the list ...
0
votes
0answers
16 views

How to simplify this battleship program? (Python)

Bear with me, I'm new to programming and I know for a fact this contains a lot of unnecessary code. Is there a way to add more ships without the code extending forever? Also a better way to code the ...
0
votes
1answer
14 views

Parameters of a function in python

I have the code below and I would like to feel the parameters of the function map at runtime. It should be like #devices = map(InputDevice, ('/dev/input/event15','/dev/input/event16')) But when I ...
0
votes
1answer
17 views

summing two columns in a pandas dataframe

when I use this syntax it creates a series rather than adding a column to my new dataframe (sum). Please help. My code: sum = data['variance'] = data.budget + data.actual My Data (in dataframe ...
0
votes
1answer
19 views

How to copy what Python last printed and put it to a string

The reason for this is for a string that prints something different than what it actually is, which I have strangely encountered. So what I want is something that gives an output like: >>>x ...
0
votes
1answer
27 views

With statement being ignored in Python

I have two functions. The first creates a new CSV file (from an existing CSV). The second appends the same data to the new CSV, but in a slightly different order of the rows. When I run this ...

15 30 50 per page