Trending questions in Python

+1 vote
10 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

The following are totally acceptable in python: passing ...READ MORE

Nov 16, 2018 in Python by Nymeria
• 3,560 points
392,005 views
0 votes
7 answers

How to use not equal operator in python

To check if operands are not equal ...READ MORE

Nov 30, 2021 in Python by Charry
343,699 views
0 votes
3 answers

how to exit a python script in an if statement

In Python, the break statement provides you with the opportunity ...READ MORE

Dec 14, 2020 in Python by Roshni
• 10,520 points
315,815 views
+1 vote
3 answers

Python error "IndentationError: expected an indented block"

Python requires its code to be indented ...READ MORE

Jun 17, 2019 in Python by Varun

edited Jun 17, 2019 302,223 views
+4 votes
4 answers

Python: UnicodeDecodeError: "utf-8" codec can"t decode byte 0xa0 in position 10: invalid start byte

You have to use the encoding as latin1 ...READ MORE

Jul 11, 2019 in Python by Ritu
264,957 views
0 votes
4 answers

How do I remove an element from a list by index in Python?

Delete the List and its element: We have ...READ MORE

Jun 7, 2020 in Python by sahil
• 580 points
242,668 views
+2 votes
3 answers

ModuleNotFoundError: No module named 'cv2'

Hi@akhtar, This error may occur if you didn't install ...READ MORE

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

How to find the index of a particular value in a dataframe?

First, use the dataframe to match the ...READ MORE

Apr 8, 2019 in Python by Esha
239,398 views
+2 votes
2 answers

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

You have to use the encoding as latin1 ...READ MORE

Jul 23, 2019 in Python by Kunal
216,268 views
0 votes
5 answers

How to read Pandas csv file with no header?

Use this logic, if header is present ...READ MORE

Mar 14, 2020 in Python by Shahabuddin
• 160 points
181,396 views
0 votes
4 answers

how to sort a list of numbers without using built-in functions like min, max or any other function?

Yes it is possible. You can refer ...READ MORE

Jun 27, 2019 in Python by Arvind
• 3,040 points
151,576 views
+1 vote
4 answers

In Python, what is difference between Array and List?

Lists and arrays are used in Python ...READ MORE

Mar 15, 2019 in Python by Taj
• 1,080 points

edited Mar 18, 2019 by Omkar 147,993 views
+1 vote
3 answers

How to change/update cell value in Python Pandas dataframe?

You can use the at() method to ...READ MORE

Apr 8, 2019 in Python by Kunal
144,373 views
+1 vote
12 answers

How to print array/ list without brackets in python?

print(*names, sep = ', ') This is what ...READ MORE

Dec 10, 2018 in Python by Sudo
140,026 views
+7 votes
8 answers

What exactly is the function of random.seed() in python?

The seed method is used to initialize the ...READ MORE

Oct 29, 2018 in Python by Rahul
123,247 views
0 votes
2 answers

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

Try this: data=pd.read_csv('/your file name', delim_whitespace=Tru ...READ MORE

Dec 10, 2020 in Python by anonymous
• 82,840 points
119,955 views
+1 vote
4 answers

How do i resolve the "unexpected indent" error in python?

Look for the whitespaces which are not ...READ MORE

Aug 2, 2019 in Python by Mohammad
• 3,230 points
115,197 views
+1 vote
3 answers

How do I share global variables across modules? - python

The best way to share global variables ...READ MORE

Jul 24, 2019 in Python by Faiza
113,970 views
+1 vote
5 answers

Python error "ERROR: Could not find a version that satisfies the requirement PyQt4 (from versions: none)"

You cannot install PyQt directly from pip. ...READ MORE

Jul 22, 2019 in Python by Bob
112,737 views
0 votes
3 answers

How to get the return value from a thread using python?

FWIW, the multiprocessing module has a nice interface for ...READ MORE

Dec 15, 2020 in Python by Roshni
• 10,520 points
101,987 views
+2 votes
4 answers

How can I replace values with 'none' in a dataframe using pandas

Actually in later versions of pandas this ...READ MORE

Aug 13, 2018 in Python by bug_seeker
• 15,530 points
106,155 views
0 votes
3 answers

(unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

You are getting this error because you ...READ MORE

Dec 31, 2019 in Python by Kalgi
• 52,350 points
86,180 views
+1 vote
3 answers

Difference between append vs. extend list methods in Python

Python append() method adds an element to ...READ MORE

Aug 21, 2019 in Python by germyrinn
• 240 points
92,991 views
0 votes
1 answer

TypeError: cannot unpack non-iterable NoneType object

Hello, The “TypeError: cannot unpack non-iterable NoneType object” ...READ MORE

Oct 5, 2020 in Python by Lisa
74,789 views
+1 vote
3 answers

How can I use python to execute a curl command?

For sake of simplicity, maybe you should ...READ MORE

Oct 11, 2018 in Python by charlie_brown
• 7,720 points
88,554 views
0 votes
3 answers

Python Pandas: ValueError: DataFrame constructor not properly called!

The syntax is not right. The right ...READ MORE

Mar 28, 2019 in Python by Ritu
81,883 views
0 votes
2 answers

How do I make python wait for a pressed key?

Then use this code: import keyboard keyboard.sleep() READ MORE

Jan 4, 2021 in Python by Reshma
63,374 views
0 votes
3 answers

TypeError: unsupported operand type(s) for -: 'str' and 'str'

& is "bitwise and" operand in Python, you ...READ MORE

Dec 11, 2020 in Python by Rajiv
• 8,910 points
76,138 views
+1 vote
4 answers

How to install tkinter in pycharm?

Ya, this is a problem with installing ...READ MORE

Apr 4, 2019 in Python by Jishan
76,751 views
0 votes
4 answers

How to print objects of class using print function in Python?

>>> class Test: ... ...READ MORE

Dec 16, 2020 in Python by Roshni
• 10,520 points
74,286 views
0 votes
3 answers

How do I find the location of my Python site-packages directory?

Configuring Python to use additional locations for ...READ MORE

Dec 28, 2020 in Python by Nikita
56,618 views
0 votes
3 answers

Pandas - FillNa with another column

You could do df.Cat1 = np.where(df.Cat1.isnull(), df.Cat2, df.Cat1 ...READ MORE

Dec 15, 2020 in Python by Roshni
• 10,520 points
67,600 views
+2 votes
3 answers

ModuleNotFoundError: No module named 'Crypto'

The module you’ve installed is different. To install ...READ MORE

Aug 20, 2019 in Python by Raman
66,138 views
0 votes
5 answers

How can I use grep in Python?

The first part starts with grep , followed by ...READ MORE

Dec 14, 2020 in Python by Gitika
• 65,910 points
65,749 views
0 votes
1 answer

Pandas: Print rows if value greater than some value

You can use condition checking for this. ...READ MORE

May 9, 2019 in Python by Reshma
72,425 views
0 votes
5 answers

what is the difference between append and insert in python lists?

There is a simple difference between append ...READ MORE

Jun 23, 2019 in Python by Harshdeep Khatke
60,599 views
0 votes
3 answers

Python exit commands - why so many and when should each be used?

The functions* quit(), exit(), and sys.exit() function in the same way: ...READ MORE

Dec 14, 2020 in Python by Gitika
• 65,910 points
64,727 views
0 votes
4 answers

Is it possible to call one python script from another Python Script?

Try using os.system: os.system("script2.py 1") execfile is different because it is ...READ MORE

Dec 16, 2020 in Python by Gitika
• 65,910 points
57,948 views
0 votes
3 answers

AttributeError: 'numpy.ndarray' object has no attribute 'append'

for root, dirs, files in os.walk(directory): ...READ MORE

Dec 12, 2020 in Python by Rajiv
• 8,910 points
50,735 views
0 votes
1 answer

How do I call a Django function on button click?

Hello @kartik, There are 2 possible solutions that ...READ MORE

Jun 23, 2020 in Python by Niroj
• 82,840 points
52,384 views
+1 vote
3 answers

How to print one pandas column without index?

There is a slight mistake in what ...READ MORE

Mar 28, 2019 in Python by Shri
57,489 views
+1 vote
4 answers

Python: convert txt file to csv format with rows and columns

Python will read data from a text ...READ MORE

Dec 14, 2020 in Python by Gitika
• 65,910 points
54,172 views
0 votes
2 answers

Do we have pointers in python like other programming languages?

From one point of view, everything is a pointer in Python. Your ...READ MORE

Dec 16, 2020 in Python by Gitika
• 65,910 points

edited Jul 8, 2021 by Sarfaraz 57,096 views
0 votes
2 answers

Is it possible to save python dictionary into json files?

You can save the Python dictionary into ...READ MORE

Mar 17, 2020 in Python by Vishal
• 180 points
57,697 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
• 62,980 points
18,894 views
0 votes
1 answer

ModuleNotFoundError: No module named 'mysql'

Hi@akhtar, You need to install mysql-connector to connect ...READ MORE

Jul 15, 2020 in Python by MD
• 95,440 points
46,626 views
0 votes
1 answer

How to install Tensorflow in pycharm ?

For installing TensorFlow your system must be ...READ MORE

Jun 23, 2020 in Python by Varsha Kumari
46,744 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,440 points
41,749 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
15,822 views
0 votes
1 answer

How to find an element in Pandas Dataframe?

You can do it like this: Suppose df is ...READ MORE

Apr 8, 2019 in Python by Tina
63,038 views