Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
0
votes
1answer
16 views
Python: Modified sorting order for a list
I have a list:
['24/2', '24/3', '25/2', '6']
I'd like to sort it so that it would come out as
['6','24/2','24/3','25/2']
However, the sorted() function returns
['24/2', '24/3', '25/2', '6']
...
0
votes
0answers
7 views
Flask-WTForms - Simple CRUD Example - Value Not Populating Form
I've read every tutorial and bit of documentation I can find, but can't find my problem. I have made this as simple as possible, using "companies" as an example. When I load my /company/edit/2 url, ...
0
votes
0answers
10 views
Test failed in Numpy pre-installed with Mac OS X
I am using the python 2.7 and numpy 1.6 pre-installed in Mac OSX. The download page advised to test it with nose after installation to see if the installation went correctly, so I did
import numpy as ...
-1
votes
1answer
28 views
Python debugging. help a noob :( [closed]
I have started to learn python and I need some help. anything will help
I use:
komodo edit <- write the python
terminal (my editor) <- bug testing
def score():
question_1 = "null" #var
...
0
votes
0answers
4 views
Error when I try to create a new project in Cocos2d (on Ubuntu)
I'm trying to create a new project on Cocos2d (Ubuntu 12.04)
When, I execute the command: /bin/bash create-android-project.sh
the wizard start, and asks me to specify the fields target id and project ...
1
vote
1answer
11 views
Python pandas an efficient way to see which column contains a value and use its coordinates as an offset
As part of trying to learn pandas I'm trying to reshape a spreadsheet. After removing non zero values I need to get some data from a single column.
For the sample columns below, I want to find the ...
0
votes
2answers
16 views
Python Pandas find non zero indices
Hi I'm trying to use pandas to tidy up a DataFrame. It is imported from a spreadsheet and has some empty rows and columns.
I thought I could use
df.apply(numpy.nonzero(),axis=1) and ...
0
votes
0answers
64 views
Objects in Python
I am new to Python objects and have a lot of questions. I need to pass a function to my object, and then evaluate the function. The code is similar to this:
from sympy import var
class eval:
def ...
0
votes
2answers
20 views
Multiple copies of array returned by numpy.arange?
I'm trying to fill a numpy array with a list of all of the x-coordinates of a pixel-based image. So basically, an n x m image would have n 1's, n 2's, and so on up to n m's. Is there a simple way to ...
0
votes
1answer
25 views
python break for nested loops without executing sub-sequential code
I am trying to figure out How I can break a nested for loop to achieve the following:
1.when it breaks out the nested for loop, it's still inside the outter for loop
2.when it breaks out the nested ...
0
votes
3answers
14 views
converting upper 128 characters in python from subprocess.popen() to use in JSON
I'm calling subprocess.popen() on the xpdf program pdfinfo, which is returning text including some characters in the upper half of the 8-bit character set.
I pass the result to a JSON serializer and ...
1
vote
2answers
47 views
Best way to change words into numbers using specific word list
I have a text file that contains tweets per line, that need to be altered for a machine learning format. Im using python and basic unix text manipulation (regex) to achieve a lot of my string ...
0
votes
1answer
17 views
Python: Breadth First Search capable of returning largest distance?
I have a dictionary representing a directed graph. For example...
myDict = {'foo': ['hello', 'stack'], 'bar' : ['over', 'flow']}
This means that the 'foo' node points to 'hello' and 'stack' while ...
5
votes
1answer
36 views
Why does numpy.r_ use brackets instead of parentheses?
Numpy.r_, .c_ and .s_ are the only Python functions I've come across that take arguments in square brackets rather than parentheses. Why is this the case? Is there something special about these ...
0
votes
0answers
10 views
Python Automate Outlook With Custom Folder- Not Default Folders
I am trying to automate Outlook mail client by retrieving a message with an attachment, using win32com. The message box is a shared folder that is not really underneath root folder inbox, so I had no ...