Most viewed questions in Python

0 votes
1 answer

How to convert multiple columns to string in pandas dataframe?

Hi, To convert multiple columns to string, include a list of ...READ MORE

Jul 19, 2019 in Python by Taj
• 1,080 points
26,889 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,700 points
26,838 views
0 votes
2 answers

How do play audio (playsound) in background of Python script?

There’s an optional second argument, block, which ...READ MORE

Jun 8, 2019 in Python by anonymous
26,784 views
+1 vote
4 answers

How to write nested dictionaries to a CSV file

Using DictWriter there is no need in ...READ MORE

Oct 18, 2018 in Python by Richard William
26,734 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,880 points
26,639 views
0 votes
1 answer

'NoneType' object has no attribute 'text

Hello @Muhammad Umer, As per the Beautiful Soup Documentation: AttributeError: ...READ MORE

Dec 7, 2020 in Python by Niroj
• 82,880 points
26,563 views
0 votes
1 answer

Django object is not JSON serializable

Hello @kartik, simplejson and json don't work with django objects well. Django's ...READ MORE

Aug 7, 2020 in Python by Niroj
• 82,880 points
26,550 views
0 votes
1 answer

ValueError: malformed string when using ast.literal_eval

Hello Kartik, An updated version of the answer ...READ MORE

May 27, 2020 in Python by Niroj
• 82,880 points
24,902 views
0 votes
1 answer

ImportError: No module named matplotlib.pyplot

Hi@akhtar, It seems you don't have matplotlib library ...READ MORE

Jun 22, 2020 in Python by MD
• 95,440 points
24,354 views
0 votes
2 answers

Python error "ImportError: No module named 'tkinter'"

sudo apt-get install python3-tk Then, >> import tkinter # ...READ MORE

Nov 9, 2019 in Python by Icetutor
• 160 points
24,272 views
0 votes
2 answers

%matplotlib inline SyntaxError: invalid syntax

I found a good solution to solve ...READ MORE

May 2, 2020 in Python by Edu
24,136 views
+1 vote
2 answers

ModuleNotFoundError: No module named 'selenium'

i fix the problem after installing go ...READ MORE

Nov 18, 2020 in Python by ahmed
23,952 views
0 votes
1 answer

How can I check for NaN in Python?

math.isnan() Checks if the float x is a ...READ MORE

Aug 16, 2018 in Python by Priyaj
• 58,090 points
23,777 views
0 votes
1 answer

Difference between end and sep

end and sep are optional parameters of ...READ MORE

Jul 30, 2019 in Python by Wajiha
• 1,950 points
23,773 views
0 votes
11 answers

“pip install unroll”: “python setup.py egg_info” failed with error code 1

rm -rf node_modules READ MORE

Jun 27, 2019 in Python by anonymous
23,479 views
0 votes
1 answer

Python: ImportError: No module named Crypto.Cipher

Seems like the pycrypto package is not ...READ MORE

Jul 31, 2019 in Python by Hari
23,446 views
0 votes
1 answer

How to set Colorbar Range in matplotlib using Python

You could scale your data to the ...READ MORE

Nov 22, 2018 in Python by Nymeria
• 3,560 points
23,424 views
0 votes
2 answers

How can I write a program to add two numbers using functions in python?

there is sum() function as a built ...READ MORE

Oct 25, 2020 in Python by anonymous
23,237 views
0 votes
2 answers

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

Hey,  @Himanshu. It's still most likely gzipped data. ...READ MORE

Jul 27, 2020 in Python by Gitika
• 65,910 points
23,174 views
0 votes
1 answer

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Hello @kartik, Since different users might have different ...READ MORE

Jun 15, 2020 in Python by Niroj
• 82,880 points
22,888 views
0 votes
1 answer

I am trying to install PIL module But I end up with an error :

Hi@Nishant, You can use PILLOW instead of PIL. $ ...READ MORE

Apr 6, 2020 in Python by MD
• 95,440 points
22,842 views
+1 vote
2 answers

Python error "ZeroDivisionError: float division by zero"

The error is thrown in this line matchPercentage ...READ MORE

May 21, 2020 in Python by Prabhakar
22,741 views
0 votes
1 answer

Python error "TypeError: string indices must be integers, not str"

Hey @Dipti email_s.append(email_1["email_address"]) This is the list on ...READ MORE

Jul 5, 2019 in Python by Jinu
22,676 views
+1 vote
1 answer

How to check if a string is null in python

Try this: if cookie and not cookie.isspace(): # the ...READ MORE

Aug 20, 2018 in Python by Priyaj
• 58,090 points
22,652 views
0 votes
1 answer

How to terminate a python script?

This can be done by importing the ...READ MORE

Aug 9, 2019 in Python by Arvind
• 3,040 points
22,515 views
0 votes
0 answers

Python shopping cart add to cart, get total get num items

I want to loop through the list ...READ MORE

Apr 25, 2022 in Python by Kichu
• 19,050 points
22,330 views
0 votes
1 answer

python JSON only get keys in first level

You just need a simple .keys() >>> dct ...READ MORE

Jan 22, 2019 in Python by SDeb
• 13,300 points
22,198 views
0 votes
1 answer

How to import a folder in Jupyter Notebook?

Hi@akhtar, There is no simple way to import ...READ MORE

Aug 17, 2020 in Python by MD
• 95,440 points
22,089 views
0 votes
1 answer

Input() error - NameError: name '…' is not defined

Hello @kartik, You should use raw_input if you are ...READ MORE

May 5, 2020 in Python by Niroj
• 82,880 points
22,078 views
0 votes
2 answers

How can I write code to find a palindrome in python without using string functions?

x="malayalam" y="" for i in x: ...READ MORE

Nov 3, 2020 in Python by Thangaraj
22,038 views
0 votes
1 answer

Is it possible in Python requests to print entire HTTP request?

A better idea is to use the ...READ MORE

Nov 26, 2018 in Python by Nymeria
• 3,560 points
21,913 views
+1 vote
2 answers

How to display column names of Pandas Dataframe?

print(list(your_df)) READ MORE

Jan 18, 2020 in Python by anonymous
21,826 views
0 votes
1 answer

How to print the index of a Pandas Dataframe?

You can do this using the code ...READ MORE

May 13, 2019 in Python by Usha
21,444 views
0 votes
1 answer
0 votes
1 answer

How to delete conda env permanently?

Hi@akhtar, You can remove your Conda environment by ...READ MORE

Jun 22, 2020 in Python by MD
• 95,440 points
21,009 views
+1 vote
3 answers

Python error "AttributeError: 'Turtle' object has no attribute 'Shape'"

Hey @Nagya, replace python.Shape("Square") with the following: python.shape("square") Python is case ...READ MORE

Jun 19, 2019 in Python by Faiza
20,990 views
0 votes
1 answer

Python: “TypeError: Object type <class 'str'> cannot be passed to C code”

You have to pass byte string as ...READ MORE

Aug 20, 2019 in Python by Jishan
20,771 views
0 votes
1 answer

How to Pivot pandas for removing of some headers and renaming of some indexes?

Solution is add parameter values to pivot, then add reset_index for column ...READ MORE

Sep 27, 2018 in Python by Priyaj
• 58,090 points
20,560 views
0 votes
1 answer
0 votes
2 answers

Tkinter “module not callable” error.

This error statement TypeError: 'module' object is ...READ MORE

Jun 27, 2019 in Python by rahul
• 360 points
20,488 views
0 votes
1 answer

How to get two tags in findall using BeautifulSoup?

You can mention both the tags in ...READ MORE

Apr 2, 2019 in Python by Giri
20,404 views
0 votes
1 answer

AttributeError: module 'numpy' has no attribute '__version__'

Hi@akhtar, To avoid this error you can use ...READ MORE

Apr 20, 2020 in Python by MD
• 95,440 points
20,382 views
0 votes
1 answer

TypeError: 'AxesSubplot' object does not support indexing

Hello , If you plot multiple subplots, the plt.subplots() returns ...READ MORE

May 7, 2020 in Python by Niroj
• 82,880 points
20,100 views
+1 vote
3 answers

How to run the Python program forever?

you can also do the old fashioned ...READ MORE

Jun 10, 2019 in Python by brianno
19,986 views
0 votes
2 answers

What's the difference between %s and %d in Python string formatting?

The reason is that they are using ...READ MORE

Feb 8, 2022 in Python by Rahul
• 9,670 points
19,881 views
0 votes
1 answer

Python Requests module - Import Error: No module named requests

Run with Python 3 from the command ...READ MORE

Sep 11, 2020 in Python by Malik Brahimi
19,844 views
0 votes
1 answer

ValueError: could not broadcast input array from shape (360,270,3) into shape (360,280,3)

Hi@akhtar, In the above error it shows could not ...READ MORE

Apr 9, 2020 in Python by MD
• 95,440 points
19,632 views
0 votes
1 answer

ProgrammingError: not all arguments converted during string formatting

Sorted!!!! just found the solution, 1 - apparently ...READ MORE

Sep 10, 2018 in Python by Priyaj
• 58,090 points
19,623 views
0 votes
4 answers

Install Python3 on Mac

Prerequisites You will need a macOS computer with ...READ MORE

Dec 15, 2020 in Python by Roshni
• 10,520 points
19,341 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

Mar 31, 2018 in Python by DareDev
• 6,890 points
19,318 views