Trending questions in Python

0 votes
0 answers

Replacements for switch statement in Python?

I want to create a Python function ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
1,359 views
0 votes
0 answers

solve syntax error

self.var_name= StringVar()                  ^ SyntaxError: invalid syntax how to solve the ...READ MORE

Oct 10, 2022 in Python by anonymous

edited Mar 4, 2025 508 views
0 votes
0 answers

How do I sort a dictionary by value?

I have some dictionary of values that ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
1,267 views
0 votes
0 answers

How do I reverse a list or loop over it backwards?

How can I perform a Python reverse ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
1,246 views
0 votes
0 answers

How to overcome timeout errors in web crawling?

My output keeps hanging indefinitely. What do ...READ MORE

Oct 9, 2022 in Python by Karthikah

edited Mar 4, 2025 482 views
0 votes
0 answers

Input In [18] t = int(c) + int(t) ^ IndentationError: expected an indented block

How can i correct this error as ...READ MORE

Oct 8, 2022 in Python by Muhammad

edited Mar 4, 2025 515 views
0 votes
0 answers

Does "IndexError: list index out of range" when trying to access the N'th item mean that my list has less than N items?

I'm instructing my software to print out ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
1,230 views
0 votes
0 answers

How to fetch dropdown value is available in side the frame using python?

The frame has no name and no ...READ MORE

Oct 7, 2022 in Python by anonymous

edited Mar 4, 2025 551 views
0 votes
0 answers

Reverse a string in Python

The str object in Python doesn't have ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
1,201 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,800 points
36,433 views
0 votes
1 answer

Python pip on Windows - command "cl.exe" failed

You should have  cl.exe (the Microsoft C Compiler) installed ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
7,465 views
0 votes
0 answers

Does Python have a ternary conditional operator?

Is there a ternary conditional operator in ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points
1,123 views
0 votes
0 answers

Java : Sort integer array without using Arrays.sort()

I have this assignment- Write java program ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
3,261 views
0 votes
0 answers

How to sum multiple columns until limit from other column is reached?

I have the following Pyspark dataframe. I ...READ MORE

Sep 27, 2022 in Python by anonymous

edited Mar 4, 2025 574 views
0 votes
0 answers

Initialising an array of fixed size in Python

I want to declare an array or ...READ MORE

Aug 11, 2022 in Python by krishna
• 2,820 points
2,563 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,800 points
37,616 views
0 votes
0 answers

How to take in the first value of a string when multiple are presented?

keyWord = ["urgent", "Linux", ...] val = input("Enter ...READ MORE

Sep 25, 2022 in Python by Edureka

edited Mar 4, 2025 551 views
0 votes
0 answers

please help with this

I need the user to type 17 ...READ MORE

Sep 25, 2022 in Python by bonicoder

edited Mar 4, 2025 481 views
0 votes
0 answers

Does Python have a string 'contains' substring method?

I'm trying to find a Python string.contains ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points

edited Mar 4, 2025 579 views
0 votes
0 answers

Relative imports in Python 3

In the same directory, I wish to ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points

edited Mar 4, 2025 566 views
0 votes
0 answers

What is the meaning of "int(a[::-1])" in Python? [duplicate]

I cannot understand this. I have seen ...READ MORE

Sep 21, 2022 in Python by Samuel
• 460 points

edited Mar 4, 2025 508 views
0 votes
0 answers

'utf-8' codec can't decode byte 0x93 in position 249: invalid start byte

from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer chatbot=ChatBot('corona ...READ MORE

Sep 17, 2022 in Python by Jash

edited Mar 4, 2025 545 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
• 86,360 points
6,289 views
0 votes
0 answers

Flattening a list of NumPy arrays?

I have data in a list type ...READ MORE

Aug 5, 2022 in Python by krishna
• 2,820 points
2,118 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,040 points
5,004 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
30,316 views
0 votes
0 answers

matrix multiplication of arrays in python

I am having trouble finding a solution ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
2,015 views
0 votes
0 answers

how do I split a large document of 10,000 words into a sub documents which contain 1000 words per each document?

There is text document of 10,000 words....I ...READ MORE

Sep 3, 2022 in Python by rakshita

edited Mar 4, 2025 550 views
0 votes
0 answers

Combined mean and standard deviation from a collection of NumPy arrays of different shapes

Consider that I have a numpy array ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
1,870 views
0 votes
0 answers

What are the differences between numpy arrays and matrices? Which one should I use?

What are each's advantages and drawbacks? I've noticed ...READ MORE

Aug 8, 2022 in Python by krishna
• 2,820 points
1,402 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,040 points
5,090 views
0 votes
0 answers

Python numpy array of numpy arrays

I have a requirement. I need to ...READ MORE

Aug 1, 2022 in Python by krishna
• 2,820 points
1,403 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,040 points
4,549 views
0 votes
0 answers

Sorting arrays in NumPy by column

How can I sort a numpy array ...READ MORE

Aug 2, 2022 in Python by krishna
• 2,820 points
1,313 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,040 points
4,816 views
0 votes
1 answer

Detect and exclude outliers in a pandas DataFrame

Function definition. This handles data when non-numeric attributes ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
5,412 views
0 votes
0 answers

Concatenate two numpy arrays in the 4th dimension

I got two numpy arrays in three ...READ MORE

Aug 1, 2022 in Python by krishna
• 2,820 points
1,238 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,040 points
4,020 views
0 votes
3 answers
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,040 points
4,396 views
0 votes
0 answers
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,040 points
4,394 views
0 votes
0 answers

while doing --channel.send('manage show '+raw1+' all a'+"\n") the "all a" taking as 2nd line so getting error

 connected to server using SSH.client and  able ...READ MORE

Aug 12, 2022 in Python by Basavraj

edited Mar 4, 2025 560 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,440 points
30,005 views
0 votes
0 answers

How to install pywhatkit in python?

if I am going to install pywhatkit ...READ MORE

Apr 22, 2022 in Python by Edureka
• 13,760 points
3,333 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
• 86,360 points
4,388 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,040 points
3,533 views
0 votes
1 answer

How to check if list is ascending?

How to write ascding order list READ MORE

Jul 17, 2022 in Python by A, b, g, x, z

edited Mar 5, 2025 15,052 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,800 points
31,823 views