Most voted questions in Python

0 votes
0 answers

How to prettyprint a JSON file?

May 27, 2022 in Python by Kichu
• 19,050 points
285 views
0 votes
0 answers

pip3: command not found but python3-pip is already installed

I am not able to use  pip3 ...READ MORE

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

Extract a page from a pdf as a jpeg

How can I  save a certain page ...READ MORE

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

How do I access environment variables in Python?

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

Python - TypeError: Object of type 'int64' is not JSON serializable

My data frame has store names and ...READ MORE

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

Find the minimum strength someone must have in the beginning so that he can cross N cells (Interview question)

Problem Statement: Mustafa wants to cross a dungeon. ...READ MORE

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

how to merge two data frames based on particular column in pandas python?

I want to  merge two data frames: df1 company,standard tata,A1 cts,A2 dell,A3 df2 company,return tata,71 dell,78 cts,27 hcl,23 I ...READ MORE

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

memory error in python

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

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

How can I install XGBoost package in python on Windows

I am using windows 64bit os and ...READ MORE

May 26, 2022 in Python by Kichu
• 19,050 points
252 views
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
256 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
863 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,123 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
342 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
276 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,120 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,337 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,346 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,070 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
368 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
196 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
505 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,988 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,269 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,233 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,129 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
760 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
949 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,974 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,547 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,804 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
7,003 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,608 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
422 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,347 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
489 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,620 points
611 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,620 points
1,753 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
234 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,298 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
422 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,620 points
1,993 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,620 points
1,364 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
332 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
284 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
453 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
267 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
317 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
332 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
242 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
237 views