Most viewed questions in Python

0 votes
2 answers

Removing Title bar in Tkinter program

you can remove the title bar by ...READ MORE

Mar 19, 2019 in Python by anonymous
19,339 views
0 votes
1 answer

Exception in Tkinter callback Traceback (most recent call last):

Hello, @R, As per the Beautiful Soup Documentation: AttributeError: 'NoneType' ...READ MORE

Dec 21, 2020 in Python by Gitika
• 65,910 points
19,245 views
0 votes
1 answer

Python pandas: print all values greater than zero in the dataframe

You can use the following code: df[df > ...READ MORE

May 13, 2019 in Python by Esha
19,150 views
0 votes
1 answer

Flask App Using WTForms with SelectMultipleField

Flask returns request.form as a werkzeug MultiDict ...READ MORE

Aug 23, 2018 in Python by aryya
• 7,450 points
19,037 views
0 votes
1 answer

Python error "pandas.errors.ParserError: Error tokenizing data"

Pandas do not take .xlsx files. Rename ...READ MORE

Jun 13, 2019 in Python by Rhea
18,716 views
0 votes
1 answer

Python error "UnboundLocalError: local variable 'x' referenced before assignment"

You get this error because when you ...READ MORE

Jul 24, 2019 in Python by Greg
18,630 views
0 votes
1 answer

How to merge multiple json objects into a single json object using python

You may do like this but it ...READ MORE

Nov 22, 2020 in Python by Gitika
• 65,910 points
18,623 views
0 votes
1 answer

How to find the value of a row in a csv file in python?

If you want to find the value ...READ MORE

May 20, 2019 in Python by Sanam
18,564 views
+1 vote
1 answer
0 votes
1 answer

Python error saying "AttributeError: can't set attribute"

change your code to the following: @x.setter def x(self, ...READ MORE

May 30, 2019 in Python by Imran
18,544 views
0 votes
2 answers

Python error "TypeError: Can't convert 'int' object to str implicitly"

A TypeError can occur if the type ...READ MORE

Feb 5, 2020 in Python by lovelmark
• 160 points
1 flag 18,170 views
+1 vote
2 answers

sklearn.cross_validation import train_test_split not working

How ever now its in model selection ...READ MORE

Jul 17, 2020 in Python by karthikeyan
17,835 views
+1 vote
5 answers

Tkinter error: tkinter.TclError: bad geometry specifier

You have to use the character ‘x’ ...READ MORE

May 9, 2019 in Python by Tina
17,675 views
0 votes
1 answer

Convert csv file to NumPy array

Hi @Lina, you can use this: numpy_array = ...READ MORE

May 24, 2019 in Python by Puneet
17,591 views
0 votes
1 answer

How do you convert two lists into a dictionary?

There are three different ways of converting ...READ MORE

May 27, 2019 in Python by Taj
• 1,080 points
17,558 views
0 votes
2 answers

Is Python fully object oriented?

Python supports all the concept of "object ...READ MORE

Sep 13, 2020 in Python by Anjali Chauhan
17,513 views
0 votes
1 answer

gaierror: [Errno 11003] getaddrinfo failed

Hi@akhtar, It most likely means the hostname of ...READ MORE

Apr 15, 2020 in Python by MD
• 95,440 points
17,453 views
0 votes
1 answer

Error:NoReverseMatch at /my_url/ Reverse for 'my_url_name' with arguments '()' and keyword arguments '{}' not found. n pattern(s) tried: []

Hello @kartik, The NoReverseMatch error is saying that Django cannot ...READ MORE

Jul 30, 2020 in Python by Niroj
• 82,880 points
17,308 views
+1 vote
2 answers

Python convert XLS and XLSX file to csv

XLSX tables are usually created in MS ...READ MORE

Aug 30, 2019 in Python by Mian Tanzeel
17,267 views
0 votes
1 answer

Convert HTML to an image in Python

webkit2png. The original version is OSX-only, but luckily ...READ MORE

Feb 5, 2019 in Python by SDeb
• 13,300 points
17,257 views
0 votes
1 answer

How to change the “tick frequency” on x or y axis in matplotlib?

You could explicitly set where you want ...READ MORE

Jan 5, 2021 in Python by Gitika
• 65,910 points
17,177 views
0 votes
1 answer

Python error "'Series' object is not callable "

Try this: df['ln_returns'] = np.log(df['Close_mid']/df['Close_mid']) df['Close_mid'](1)) doesn't seem to ...READ MORE

Jul 22, 2019 in Python by Greg
17,120 views
0 votes
2 answers

Manually raising (throwing) an exception in Python

Exception handling issues in python can easily ...READ MORE

Jan 18, 2019 in Python by nick
• 140 points
17,110 views
0 votes
1 answer

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

Hi, @hala, Regarding your query, you can go ...READ MORE

Jun 29, 2020 in Python by Niroj
• 82,880 points
17,002 views
0 votes
2 answers

Python error " import requests ImportError: No module named requests"

Hello, Open Cmd or Powershell as Admin. type pip ...READ MORE

Nov 28, 2020 in Python by Rohan
• 200 points
16,915 views
+1 vote
2 answers

Remove all whitespace in a string in Python

You can also use regular expressions for ...READ MORE

Aug 31, 2018 in Python by Omkar
• 69,210 points
16,859 views
0 votes
1 answer

How to uninstall a package installed with pip install --user?

Having tested this using Python 3.5 and ...READ MORE

Dec 4, 2020 in Python by Gitika
• 65,910 points
16,805 views
0 votes
1 answer

How do I obtain the index list in a NumPy Array of all the NaN values present using Python?

Hi, it is pretty simple, to be ...READ MORE

Jan 30, 2019 in Python by Nymeria
• 3,560 points
16,765 views
0 votes
1 answer

How to access a dictionary element in a Django template?

Hello @kartik, Use Dictionary Items: {% for key, value ...READ MORE

Jul 3, 2020 in Python by Niroj
• 82,880 points
16,762 views
+1 vote
2 answers

Replace every character of string by character whose ASCII value is K times more than it

Refer below code for your problem statement def ...READ MORE

May 17, 2020 in Python by Kumar Sambhawam

edited May 18, 2020 by Gitika 16,756 views
0 votes
1 answer

Difference between python programing and scripting

Hi,@Sashi, Generally, all the scripting languages are considered ...READ MORE

Nov 27, 2020 in Python by Gitika
• 65,910 points
16,593 views
0 votes
1 answer

Python: Splitting numPY 2 D Array

For splitting the 2d array,you can use ...READ MORE

Jul 15, 2019 in Python by Siri

edited Oct 7, 2021 by Sarfaraz 16,584 views
0 votes
1 answer

What is difference between "inplace = True" and "inplace = False?

Hi, Both inplace= true and inplace = False ...READ MORE

Aug 9, 2019 in Python by Taj
• 1,080 points
16,564 views
0 votes
1 answer

Python strftime- date without leading 0?

If you add a hyphen between the ...READ MORE

Dec 31, 2018 in Python by SDeb
• 13,300 points
16,543 views
0 votes
2 answers

ModuleNotFoundError: No module named 'apyori'

apriori is python 2.7 module so this ...READ MORE

Jun 9, 2020 in Python by sahil
• 580 points
16,462 views
+4 votes
1 answer

Print the odd and even factors of a number in Python

x = int(input("Enter any number \n")) print("The factors ...READ MORE

Nov 19, 2018 in Python by Nabarupa
16,458 views
0 votes
1 answer

Python string replace not working

The replace method doesn’t store the altered ...READ MORE

Apr 4, 2019 in Python by Tina

edited Oct 7, 2021 by Sarfaraz 16,449 views
0 votes
1 answer

How to write inline if statement for print in Python?

Inline if-else expression must always contain the else ...READ MORE

Dec 4, 2018 in Python by Nymeria
• 3,560 points

edited Dec 6, 2018 by Nymeria 16,428 views
+1 vote
1 answer

Error:__init__() got an unexpected keyword argument 'user'

Hello @kartik, You can't do LivingRoom.objects.create(user=instance) because you have an __init__ method ...READ MORE

Jun 30, 2020 in Python by Niroj
• 82,880 points
16,400 views
0 votes
2 answers

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

Hi@akhtar, The range function does not work with ...READ MORE

Jun 29, 2020 in Python by MD
• 95,440 points
16,345 views
0 votes
1 answer

ModuleNotFoundError: No module named 'nltk'

Hi@akhtar, It seems this module is not present ...READ MORE

Jun 26, 2020 in Python by MD
• 95,440 points
16,236 views
0 votes
1 answer

Change the window background color using turtle - python

Try this: import turtle #set up the screen wn = ...READ MORE

Jun 19, 2019 in Python by Faiza
16,053 views
0 votes
1 answer

How do I make a field readonly (or disabled) so that it cannot be edited in Django form?

Hello @kartik, Setting readonly on a widget only makes the ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,880 points
15,907 views
+1 vote
1 answer

How to handle Real-Time Matplotlib Plotting

To draw a continuous set of random ...READ MORE

Sep 26, 2018 in Python by Priyaj
• 58,090 points
15,768 views
0 votes
1 answer

How to check if a website allows web scraping?

To check if a website allows web ...READ MORE

Jun 14, 2019 in Python by Wajiha
• 1,950 points
15,713 views
0 votes
2 answers

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

Thanks, This answer was helpful. READ MORE

Jul 11, 2020 in Python by Prashant Chhatrashali
15,668 views
0 votes
2 answers

Avoiding multiple nested for-loops in python

Instead of multi-loop, If you can categorize ...READ MORE

Sep 15, 2018 in Python by pedro67657
• 160 points

edited Sep 15, 2018 by Vardhan 15,648 views
+1 vote
1 answer

Python BeautifulSoup check if find returns Null object

You can add an if condition to ...READ MORE

May 9, 2019 in Python by Ruby
15,608 views
0 votes
1 answer

How to convert .ipynb files into .py?

You can use this command to convert ...READ MORE

Aug 8, 2019 in Python by hansika
15,568 views
0 votes
1 answer

Python Error saying "NameError: global name 'true' is not defined"

It's a very small mistake. Change true ...READ MORE

Jun 17, 2019 in Python by Vinayak

edited Oct 7, 2021 by Sarfaraz 15,561 views