Latest questions in Python

0 votes
0 answers

How do I do a case-insensitive string comparison?

How can I do case-insensitive string comparison ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
247 views
0 votes
0 answers

How to input matrix (2D list) in Python?

I am working on a code that ...READ MORE

May 24, 2022 in Python by Kichu
• 19,050 points
851 views
0 votes
0 answers

dlib installation on Windows 10

 I have the python app running great ...READ MORE

May 24, 2022 in Python by Kichu
• 19,050 points
1,116 views
0 votes
0 answers

How do I convert a datetime to date?

How do I convert a datetime.datetime object ...READ MORE

May 24, 2022 in Python by Kichu
• 19,050 points
337 views
0 votes
0 answers

Why am I getting a FileNotFoundError?

I am working on a program that ...READ MORE

May 24, 2022 in Python by Kichu
• 19,050 points
270 views
0 votes
0 answers

TypeError: 'type' object is not subscriptable when indexing in to a dictionary

I use dict to shorten things as ...READ MORE

May 24, 2022 in Python by Kichu
• 19,050 points
1,113 views
0 votes
0 answers

iloc giving 'IndexError: single positional indexer is out-of-bounds'

I was trying to encode some information ...READ MORE

May 23, 2022 in Python by Kichu
• 19,050 points
1,331 views
0 votes
0 answers

Relative imports - ModuleNotFoundError: No module named x

I have these  two files: test.py config.py These are the following ...READ MORE

May 23, 2022 in Python by Kichu
• 19,050 points
1,325 views
0 votes
0 answers

Flask ImportError: No Module Named Flask

I followed this flask tutorial: http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world. I am getting ...READ MORE

May 23, 2022 in Python by Kichu
• 19,050 points
2,057 views
0 votes
0 answers

Writing a pandas DataFrame to CSV file

I want to write a pandas data ...READ MORE

May 21, 2022 in Python by Kichu
• 19,050 points
364 views
0 votes
0 answers

Python's equivalent of && (logical-and) in an if-statement

This is not  working : if cond1 && cond2: Can ...READ MORE

May 20, 2022 in Python by Kichu
• 19,050 points
194 views
0 votes
0 answers

ModuleNotFoundError: No module named 'sklearn'

I am using Anaconda and Python 3.6.1 ...READ MORE

May 20, 2022 in Python by Kichu
• 19,050 points
495 views
0 votes
0 answers

Constructing pandas DataFrame from values in variables gives "ValueError: If using all scalar values, you must pass an index"

If  I have two variables as follows: a ...READ MORE

May 19, 2022 in Python by Kichu
• 19,050 points
1,962 views
0 votes
0 answers

No acceptable C compiler found in $PATH when installing python

I followed this post to install a ...READ MORE

May 19, 2022 in Python by Kichu
• 19,050 points
1,260 views
0 votes
0 answers

Error in Python script "Expected 2D array, got 1D array instead:"?

I wanted to make this ML prediction ...READ MORE

May 18, 2022 in Python by Kichu
• 19,050 points
1,221 views
0 votes
0 answers

PermissionError: [Errno 13] Permission denied

This is the code : def download(): ...READ MORE

May 14, 2022 in Python by Kichu
• 19,050 points
3,118 views
0 votes
0 answers

"getaddrinfo failed", what does that mean?

I am getting this error when launching ...READ MORE

May 13, 2022 in Python by Kichu
• 19,050 points
741 views
0 votes
0 answers

'str' object has no attribute 'decode'. Python 3 error?

Code: import imaplib from email.parser import HeaderParser conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login('example@gmail.com', ...READ MORE

May 13, 2022 in Python by Kichu
• 19,050 points
940 views
0 votes
0 answers

Python Traceback (most recent call last)

The error message: Traceback (most recent call last): ...READ MORE

May 12, 2022 in Python by Kichu
• 19,050 points
2,959 views
0 votes
0 answers

ImportError: No module named pip

I installed setuptools 1.0 with ez_setup.py from https://pypi.python.org/pypi/setuptools. Then ...READ MORE

May 12, 2022 in Python by Kichu
• 19,050 points
1,535 views
0 votes
0 answers

OpenCV NoneType object has no attribute shape

I  am working on Raspberry Pi with ...READ MORE

May 9, 2022 in Python by Kichu
• 19,050 points
2,795 views
0 votes
0 answers

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I am facing an error when decoding ...READ MORE

May 9, 2022 in Python by Kichu
• 19,050 points
6,992 views
0 votes
0 answers

Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

 I am getting this error: Truth value of ...READ MORE

May 9, 2022 in Python by Kichu
• 19,050 points
1,600 views
0 votes
0 answers

Conda: Creating a virtual environment

I am trying to create a virtual ...READ MORE

May 9, 2022 in Python by Kichu
• 19,050 points
413 views
0 votes
0 answers

TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array

I am working on a function that ...READ MORE

May 8, 2022 in Python by Kichu
• 19,050 points
2,338 views
0 votes
0 answers

TypeError: 'int' object is not callable

This is the code : from __future__ import ...READ MORE

May 8, 2022 in Python by Kichu
• 19,050 points
480 views
0 votes
0 answers

How can I prevent the TypeError: list indices must be integers, not tuple when copying a python list to a numpy array?

I want to create 3 numpy arrays/lists ...READ MORE

May 7, 2022 in Python by narikkadan
• 63,420 points
604 views
0 votes
0 answers

re.sub erroring with "Expected string or bytes-like object"

I tried looping through my function but ...READ MORE

May 7, 2022 in Python by narikkadan
• 63,420 points
1,745 views
0 votes
0 answers

Renaming column names in Pandas

How can  I change the column labels of ...READ MORE

May 5, 2022 in Python by Kichu
• 19,050 points
231 views
0 votes
0 answers

TypeError: 'NoneType' object is not iterable in Python

What does this error mean?  I get this ...READ MORE

May 5, 2022 in Python by Kichu
• 19,050 points
1,279 views
0 votes
0 answers

IndentationError: unindent does not match any outer indentation level

When I compile  my python code I ...READ MORE

May 2, 2022 in Python by Kichu
• 19,050 points
417 views
0 votes
1 answer

ValueError: setting an array element with a sequence

The problem is the shape of the ...READ MORE

May 1, 2022 in Python by narikkadan
• 63,420 points
1,969 views
0 votes
1 answer

Error: 'int' object is not subscriptable - Python

The issue is in the line: int([x[age1]]) The solution ...READ MORE

Apr 30, 2022 in Python by narikkadan
• 63,420 points
1,355 views
0 votes
0 answers

Switching between Python 3.7 and 3.8 under Anaconda

What is the rationale for having two ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
326 views
0 votes
0 answers

How do I use method overloading in Python?

I am trying to implement method overloading ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
281 views
0 votes
0 answers

How to generate all permutations of a list?

How do you generate all the permutations ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
450 views
0 votes
0 answers

Quicksort with Python

I am totally new to python and ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
262 views
0 votes
0 answers

Python vs Cpython

What exactly is CPython and how does ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
313 views
0 votes
0 answers

If in Python I put a list inside a tuple, can I safely change the contents of that list?

The value inside the tuple is simply ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
321 views
0 votes
0 answers

What does the "yield" keyword do?

What is the use of the yield ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
231 views
0 votes
0 answers

Function for factorial in Python

How do I go about computing a ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,620 points
229 views
0 votes
1 answer

Is Python strongly typed?

Python is both strongly and dynamically typed. Strongly ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
707 views
0 votes
1 answer

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip

Just add the package containing the executable pg_config. ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
7,084 views
0 votes
1 answer

Python pip on Windows - command "cl.exe" failed

You should have  cl.exe (the Microsoft C Compiler) installed ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
3,545 views
0 votes
1 answer

EOFError: EOF when reading a line

The code: width, height = map(int, input().split()) def rectanglePerimeter(width, ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
4,304 views
0 votes
1 answer

What is the difference between read() and readline() in python?

The read() will read the whole file at ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
15,024 views
0 votes
1 answer

Python: Could not install packages due to an OSError: [Errno 2] No such file or directory

I also met with the same problem ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
35,176 views
0 votes
1 answer

ValueError: could not convert string to float: id

The problem is that in your code ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
8,296 views
0 votes
1 answer

Plot correlation matrix using pandas

Just use pyplot.matshow() from matplotlib: import matplotlib.pyplot as plt plt.matshow(dataframe.corr()) plt.show() If df.corr() ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
1,757 views
0 votes
1 answer

How to urlencode a querystring in Python?

Just pass your parameters into urlencode() like: >>> import urllib >>> ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 63,420 points
423 views