Most viewed questions in Python

0 votes
1 answer

TypeError - 'float' object cannot be interpreted as an integer

Hi, @There, The “TypeError: ‘float’ object cannot be ...READ MORE

Nov 13, 2020 in Python by Gitika
• 65,770 points
52,522 views
0 votes
3 answers

Python pandas: TypeError: tuple indices must be integers or slices, not str

In fact, I get a perfectly good ...READ MORE

Jun 13, 2019 in Python by Alok
51,529 views
0 votes
1 answer

ModuleNotFoundError: No module named 'mysql'

don't give filaname as mysql.py give another ...READ MORE

Jan 6, 2022 in Python by anonymous

edited Mar 5 50,838 views
0 votes
1 answer

/usr/bin/env: ‘python’: No such file or directory

Hi@akhtar, It seems your python script is not ...READ MORE

Sep 20, 2020 in Python by MD
• 95,460 points
49,685 views
0 votes
3 answers

How to replace negative numbers in Pandas Data Frame by zero?

 If all your columns are numeric, you ...READ MORE

Dec 16, 2020 in Python by Rajiv
• 8,870 points
45,336 views
0 votes
1 answer

How do I install the yaml package for Python?

Hello @kartik, You could try the search feature ...READ MORE

May 12, 2020 in Python by Niroj
• 82,840 points
44,428 views
0 votes
3 answers

Python error "NameError: name 'sr' is not defined"

write at start of code import speech_recognition as ...READ MORE

Mar 17, 2021 in Python by Honir

edited Mar 5 43,504 views
+1 vote
3 answers

ModuleNotFoundError: No module named 'speech_recognition' Not able to install speech_recognition in python:

Hey. You have to use SpeechRecognition as module ...READ MORE

Nov 28, 2018 in Python by Omkar
• 69,220 points
42,861 views
0 votes
1 answer

KeyError: "['Place'] not found in axis"

I think you had click on run ...READ MORE

Mar 1, 2021 in Python by Bulky

edited Mar 5 41,644 views
0 votes
1 answer

Error - 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,600 points
41,331 views
0 votes
1 answer

Pytesseract : "TesseractNotFound Error: tesseract is not installed or it's not in your path", how do I fix this?

copy the path the tesseract-ocr is stored ...READ MORE

Aug 29, 2023 in Python by swagger khan

edited Mar 5 40,698 views
0 votes
1 answer

How to convert BeautifulSoup object to string?

You can do this by directly type ...READ MORE

Apr 4, 2019 in Python by Ashu
39,196 views
0 votes
3 answers

Command "python setup.py egg_info" failed with error code 1 in C:\Users\Nadeem\AppData\Local\Temp\

You have an out of date version ...READ MORE

Dec 15, 2020 in Python by Rajiv
• 8,870 points
38,307 views
+2 votes
2 answers

ImportError: numpy.core.multiarray failed to import

try this... run this code one by one.... pip ...READ MORE

Nov 5, 2020 in Python by Anand Vijay Rajsri

reshown Nov 5, 2020 by Sirajul 37,741 views
+1 vote
1 answer

How to get the currently logged in user's user id in Django?

Hello @kartik, First make sure you have SessionMiddleware and AuthenticationMiddleware middlewares added ...READ MORE

Aug 12, 2020 in Python by Niroj
• 82,840 points
37,514 views
0 votes
1 answer

How do you add a background thread to flask in Python?

The example below creates a background thread ...READ MORE

Nov 19, 2018 in Python by Nymeria
• 3,560 points
37,164 views
+1 vote
8 answers

Count the frequency of an item in a python list

To count the number of appearances: from collections ...READ MORE

Oct 18, 2018 in Python by tinitales
36,442 views
0 votes
3 answers

TypeError: 'module' object is not callable

I got this issue because of the ...READ MORE

Sep 21, 2022 in Python by Vishal Gupta

edited Mar 5 36,374 views
0 votes
1 answer

Error:django MultiValueDictKeyError

Hello @kartik, Use the MultiValueDict's get method. This is also ...READ MORE

May 20, 2020 in Python by Niroj
• 82,840 points
36,156 views
0 votes
3 answers

import NumPy as np ImportError: No module named NumPy

You need to install numpy using pip install ...READ MORE

Dec 16, 2020 in Python by Roshni
• 10,480 points
35,949 views
+4 votes
7 answers

Splitting a List into chunks in Python

Here's a generator that yields the chunks ...READ MORE

Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
35,944 views
+4 votes
3 answers

Write a for loop that prints all elements of a list and their position in the list. a = [4,7,3,2,5,9]

Try using this question by list comprehension: a=[4,7,3,2,5,9] print([x for ...READ MORE

Dec 9, 2019 in Python by vinaykumar
• 200 points
35,350 views
0 votes
1 answer

How do I upgrade my pycharm from python 2.7 to python 3?

Install Python 3.7(latest version) from the following ...READ MORE

Aug 5, 2019 in Python by Varsha
34,931 views
+1 vote
2 answers

What is the difference between .py and .pyc files in Python?

Hi, @Roshni, You can follow a few steps ...READ MORE

Jun 23, 2020 in Python by Gitika
• 65,770 points
34,887 views
0 votes
1 answer

How do I filter query objects by date range in Django?

Hello @kartik, Use Sample.objects.filter(date__range=["2020-01-01", "2020-01-31"]) Or if you are just ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,840 points
34,769 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

Nov 12, 2018 in Python by Nymeria
• 3,560 points
34,644 views
–1 vote
2 answers

In Python, How do I read 2 CSV files, compare column 1 from both, and then write to a new file where the Column 1s match?

Hi @Mike. First, read both the csv ...READ MORE

Jul 24, 2019 in Python by Omkar
• 69,220 points
34,101 views
0 votes
3 answers

i am installing wordcloud using pip but i am unable to do that ....i am getting the following error

word cloud is not supported for python ...READ MORE

Apr 15, 2020 in Python by anonymous
33,934 views
0 votes
1 answer

UnicodeDecodeError: "utf-8" codec can"t decode byte 0xeb in position 8: unexpected end of data

To read this dataset use encoding as ...READ MORE

Jul 15, 2019 in Python by Rishi
33,491 views
0 votes
2 answers

NameError: name 'raw_input' is not defined

Hi, There may a problem with your python ...READ MORE

Jun 25, 2020 in Python by MD
• 95,460 points
33,218 views
0 votes
1 answer

mysql.connector.errors.NotSupportedError: Authentication plugin 'caching_sha2_password' is not supported

I had the same problem and passing ...READ MORE

Oct 1, 2021 in Python by anonymous

edited Mar 5 32,353 views
0 votes
1 answer

'Conda' is not recognized as internal or external command

I was coming across the same issue ...READ MORE

Feb 11, 2022 in Python by Soham
• 9,710 points
32,020 views
0 votes
2 answers

Python Error: No python at 'C:\Users\dell\Appdata\Local\Programs\Python\Python37-32\python.exe'

follow these steps:- 1.open file ->setting -> interpreter ...READ MORE

Apr 30, 2021 in Python by Kiran Ahluwalia

edited Mar 5 31,400 views
0 votes
3 answers

Python program to print occurrence of character in string

Try below code string = input("Enter a string: ...READ MORE

May 28, 2020 in Python by Anubhav
• 300 points
31,363 views
0 votes
3 answers

Best way to convert string to bytes in Python?

We can use the built-in Bytes class in Python ...READ MORE

Dec 28, 2020 in Python by David Samon
31,142 views
0 votes
1 answer

How do I execute multiple SQL statements at once? - Python

You can use sqlite3 module. Have a ...READ MORE

Jun 20, 2019 in Python by Travis
30,982 views
0 votes
1 answer

Pandas df header on 2 row

By default when you import a file, ...READ MORE

Apr 4, 2019 in Python by Yogi
30,580 views
+2 votes
2 answers

ModuleNotFoundError: No module named 'pyttsx3

Hi@akhtar, To avoid this error you have to ...READ MORE

Apr 24, 2020 in Python by MD
• 95,460 points
30,551 views
0 votes
1 answer

Python Error ""ValueError: could not broadcast input array from shape (4) into shape (1000)""

There are better ways of achieving the ...READ MORE

Jun 14, 2019 in Python by Faiza
30,290 views
0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

Nov 27, 2018 in Python by Rupali
30,077 views
0 votes
1 answer

Python TypeError: 'list' object is not callable.

The error says the list is not ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,220 points
29,563 views
+2 votes
6 answers

How can I change directory or "cd" in Python?

Context Manager: cd import os class cd:     """Context manager for ...READ MORE

Oct 18, 2018 in Python by Nabarupa
29,537 views
0 votes
1 answer

Create a constant in Python?

No there is not. You cannot declare ...READ MORE

Aug 24, 2018 in Python by Priyaj
• 58,020 points
29,195 views
0 votes
1 answer

ValueError("arrays must all be same length") ValueError: arrays must all be same length

Hi,  You need to specify index for your ...READ MORE

Jun 25, 2020 in Python by MD
• 95,460 points
29,158 views
0 votes
2 answers

How to click button selenium python?

Selenium can automatically click on buttons that ...READ MORE

Oct 14, 2020 in Python by Danish Bhatiya
29,114 views
0 votes
1 answer

How to parse `request.body` from POST in Django?

Hello @kartik, In Python 3.0 to Python 3.5.x, json.loads() will ...READ MORE

Aug 5, 2020 in Python by Niroj
• 82,840 points
29,086 views
0 votes
1 answer

How to do a not equal in Django queryset filtering?

Hello @kartik, Your query appears to have a ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,840 points
29,055 views
0 votes
1 answer

What is the difference between pop() and remove()?

Array elements can be removed using pop() ...READ MORE

Jun 20, 2019 in Python by Nisa
• 1,090 points
29,023 views
0 votes
1 answer

how to solve this IndexError: list index out of range in python and streamlit?

Hi,  @Erick, To solve the “index error: list ...READ MORE

Sep 25, 2020 in Python by Roshni
• 10,480 points
28,747 views
0 votes
1 answer

What is the difference between driver.close() and driver.quit()?

close- This method is used to close ...READ MORE

Aug 20, 2021 in Python by anonymous

edited Mar 5 28,660 views