Top "Python-2.7" questions

Python 2.7 is the last major version in the 2.x series, and is no longer maintained since January 1st 2020.

ImportError: No module named scipy

I am using Python 2.7 and trying to get PyBrain to work. But I get this error even though scipy is …

python python-2.7 scipy pybrain
ImportError: numpy.core.multiarray failed to import

I'm trying to run this program import cv2 import time cv.NamedWindow("camera", 1) capture = cv.CaptureFromCAM(0) while True: img = cv.…

python python-2.7 numpy opencv
If list index exists, do X

In my program, user inputs number n, and then inputs n number of strings, which get stored in a list. …

python python-2.7
Get the first element of each tuple in a list in Python

An SQL query gives me a list of tuples, like this: [(elt1, elt2), (elt1, elt2), (elt1, elt2), (elt1, elt2), (elt1, …

python python-2.7 syntax
How to display pandas DataFrame of floats using a format string for columns?

I would like to display a pandas dataframe with a given format using print() and the IPython display(). For example: …

python python-2.7 pandas ipython dataframe
Python Variable Declaration

Learning Python, and has some basic doubts. 1.I have seen variable declaration (path here) as class writer: path = "" sometimes, no …

python python-3.x python-2.7 variable-declaration
Convert string to variable name in python

I have any string. like 'buffalo', x='buffalo' I want to convert this string to some variable name like, buffalo=4 …

python python-2.7
How to remove \xa0 from string in Python?

I am currently using Beautiful Soup to parse an HTML file and calling get_text(), but it seems like I'm …

python python-2.7 unicode beautifulsoup utf-8
Skip the headers when editing a csv file using Python

I am using below referred code to edit a csv using Python. Functions called in the code form upper part …

python python-2.7 csv
How to display the first few characters of a string in Python?

Hi I just started learning Python but I'm sort of stuck right now. I have hash.txt file containing thousands …

python python-2.7