Trending questions in Python

0 votes
0 answers

cannot connect to Visual code thru Python, getting 500 error code

500 Sorry, something went wrong on our system. ...READ MORE

May 19, 2021 in Python by Kailash

edited Mar 4, 2025 467 views
0 votes
1 answer

Error:mysql_config not found when installing mysqldb python interface

Hello @kartik, MySQLdb is a python interface for ...READ MORE

May 27, 2020 in Python by Niroj
• 82,800 points
15,842 views
0 votes
0 answers

Could not find a version that satisfies the requirement itertools (from versions: none)

Hi Sir, I am trying to install itertools ...READ MORE

May 15, 2021 in Python by Bhavana

edited Mar 4, 2025 636 views
0 votes
1 answer

How to load Numpy array in Jupyter Notebook?

Hi@akhtar, You can use numpy.load() function to load ...READ MORE

Jun 22, 2020 in Python by MD
• 95,460 points
14,663 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
30,522 views
0 votes
1 answer

How to concatenate strings in django templates?

Hello @kartik, Don't use add for strings, you should define ...READ MORE

Aug 3, 2020 in Python by Niroj
• 82,800 points
12,795 views
0 votes
1 answer

Python Error: ModuleNotFoundError: No module named '<moduleName>'

Python3 and pip are most likely pointing ...READ MORE

Nov 22, 2020 in Python by Gitika
• 65,730 points
7,988 views
0 votes
0 answers

How to correlate data in 2 csv files

I am a swim coach. I want ...READ MORE

May 15, 2021 in Python by Lokesh

edited Mar 4, 2025 516 views
0 votes
1 answer

How does numpy.newaxis work and when to use it?

Hello, The np.newaxis is generally used with slicing. It indicates ...READ MORE

Apr 14, 2020 in Python by Niroj
• 82,800 points
17,441 views
0 votes
0 answers

I am trying to execute a python code

def __init__(self, mode=False, maxHands=2, detectionCon=0.5, trackCon=0.5):        ^ IndentationError: ...READ MORE

May 13, 2021 in Python by 9A 43

edited Mar 4, 2025 447 views
0 votes
0 answers

how can I make this code without built in function(sort,sorted) ?

class KeyIndex:     def __init__(self, a):         self.k = a     def search(self, ...READ MORE

May 11, 2021 in Python by anonymous

edited Mar 4, 2025 466 views
0 votes
1 answer

How do I perform query filtering in django templates?

Hello @KARTIK, Just add an extra template tag ...READ MORE

Jul 4, 2020 in Python by Niroj
• 82,800 points
13,877 views
0 votes
0 answers

Why can't I use Screen from turtle module ?

TypeError: '_Screen' object is not callable READ MORE

May 9, 2021 in Python by anonymous

edited Mar 4, 2025 491 views
0 votes
1 answer

%matplotlib inline SyntaxError: invalid syntax

If you're using Jupyter notebook, just mention this ...READ MORE

Aug 1, 2019 in Python by Merlin

edited Jun 25, 2020 by MD 28,362 views
+1 vote
2 answers

How to print first character of each word in upper case of a string in Python

text = "this is a sample python ...READ MORE

Jun 22, 2022 in Python by anonymous

edited Mar 5, 2025 14,636 views
0 votes
1 answer

How to install packages using pip according to the requirements.txt file from a local directory?

This works for me: $ pip install -r ...READ MORE

Dec 4, 2020 in Python by Gitika
• 65,730 points
7,064 views
0 votes
1 answer
0 votes
1 answer

How can I return HTTP status code 204 from a Django view?

Hello, Try this: return HttpResponse(status=204) Hope it works!! ...READ MORE

Aug 17, 2020 in Python by Niroj
• 82,800 points
11,757 views
0 votes
0 answers

How can I extract specific data from pdf & image using python and also Convert it to csv file?

Suppose we have  a pdf of books ...READ MORE

May 4, 2021 in Python by Edureka
• 120 points

edited Mar 4, 2025 590 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
25,875 views
0 votes
0 answers

IndentationError: expected an indented block

I am a beginner and this my ...READ MORE

May 6, 2021 in Python by anonymous

edited Mar 4, 2025 433 views
0 votes
0 answers

Pandas DataFrame combine rows by column value, where Date Rows are NULL

Scenerio: Parse the PDF Bank statement and ...READ MORE

May 2, 2021 in Python by zeroxlearner

edited Mar 4, 2025 520 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 19,100 views
0 votes
0 answers

I'm new to programming so I want to add the functions in my code to a class so can anyone edit it, because I don't know how to use classes and I need an example.

def displayMenu():     status = input("Are you registered user? ...READ MORE

Apr 30, 2021 in Python by anonymous

edited Mar 4, 2025 495 views
0 votes
1 answer

How can I get the absolute URL (with domain) in Django?

Hello @kartik, Use handy request.build_absolute_uri() method on request, pass it ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,800 points
11,971 views
0 votes
1 answer

TypeError: Expected Ptr<cv::UMat> for argument '%s' ''

src is the first argument to cv2.cvtColor. The error you ...READ MORE

Oct 15, 2020 in Python by anonymous
• 65,730 points
8,923 views
0 votes
1 answer

How to expire session due to inactivity in Django?

Hello @kartik, Expire the session on browser close ...READ MORE

Aug 13, 2020 in Python by Niroj
• 82,800 points
11,671 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
33,122 views
0 votes
1 answer

ImportError: No module named pip when trying to install packages

Hello @kartik, I found that on Ubuntu, pip ...READ MORE

May 27, 2020 in Python by Niroj
• 82,800 points
14,977 views
0 votes
1 answer

Getting error "AttributeError: 'Screen' object has no attribute 'title' on line 8"

Hey @TedTickles,  Replace  wn.update() with turtle.up ...READ MORE

Dec 24, 2020 in Python by Gitika
• 65,730 points
5,868 views
0 votes
1 answer

How to catch multiple exceptions in one line in python?

From Python Documentation: An except clause may name multiple ...READ MORE

Dec 17, 2020 in Python by Gitika
• 65,730 points
6,109 views
0 votes
1 answer

How can I get the username of the logged-in user in Django?

Hello @kartik, You can use the request object ...READ MORE

Jul 29, 2020 in Python by Niroj
• 82,800 points
12,184 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
20,331 views
0 votes
1 answer

How to list a column of float values from csv file without importing (Python)

Using the default CSV module Demo: import csv with open(filename, "r") ...READ MORE

Sep 16, 2020 in Python by Rajiv
• 8,870 points
10,062 views
0 votes
1 answer

shows "name connection not defined"

Hi, @Imthiii, Try removing the bracket you have ...READ MORE

Sep 17, 2020 in Python by Rajiv
• 8,870 points
9,986 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
38,850 views
0 votes
1 answer

How to convert list into 2 tuple pair list?

This should work: L = [1, 2, 3, ...READ MORE

Nov 4, 2020 in Python by Gitika
• 65,730 points
7,928 views
0 votes
0 answers
0 votes
1 answer

How to return the current user with Django Rest Framework?

Hello @kartik, The best way is to use ...READ MORE

Jun 25, 2020 in Python by Niroj
• 82,800 points
13,413 views
0 votes
0 answers

The program will input a string then display all the letters used in the input with their corresponding number of occurrences in the input.

Sample: Input a String: This is FUN. ...READ MORE

Apr 18, 2021 in Python by anonymous

edited Mar 4, 2025 532 views
0 votes
1 answer

How to find which version of package is installed with pip?

As of pip 1.3, there is a pip show command. $ ...READ MORE

Dec 4, 2020 in Python by Gitika
• 65,730 points
6,295 views
0 votes
0 answers

Python error ValueError size needs to be int width int height while using pygame Surface

I'm trying to make a game on ...READ MORE

Apr 19, 2021 in Python by anonymous

edited Mar 4, 2025 494 views
0 votes
2 answers

ImportError: No system module 'pywintypes' (pywintypes38.dll)

I just copied the DLL pywintypes27.dll in C:\Python27\Lib\site-packages\pywin32_system32. I added it ...READ MORE

Nov 25, 2020 in Python by Roshni
• 10,440 points
6,628 views
0 votes
0 answers

How to edit a data frame series

I have the below series in a ...READ MORE

Apr 17, 2021 in Python by Edureka

edited Mar 4, 2025 541 views
0 votes
1 answer

How to find the value of a row in a csv file in python and print column and row of that value ?

Hello @Khanhh , Use panda to find the value of ...READ MORE

Oct 15, 2020 in Python by Niroj
• 82,800 points
8,356 views
+1 vote
1 answer

Error:Unable to import path from django.urls

Hello @kartik, You need Django version 2 pip install ...READ MORE

Jul 2, 2020 in Python by Niroj
• 82,800 points
12,822 views
0 votes
1 answer

AttributeError: type object 'numpy.ndarray' has no attribute '__array_function__'

Hi@akhtar, I think numpy version is not compatible ...READ MORE

Apr 13, 2020 in Python by MD
• 95,460 points
16,289 views
0 votes
0 answers

E: Error, pkgProblemResolver

Good day Please excuse my ignorance as I ...READ MORE

Apr 14, 2021 in Python by gurowar

edited Mar 4, 2025 515 views
0 votes
1 answer

Creating an empty Pandas DataFrame, then filling it?

Here's a couple of suggestions: Use date_range for the index: import ...READ MORE

Jan 5, 2021 in Python by Gitika
• 65,730 points
4,729 views
0 votes
1 answer

if/else in a list comprehension

You can totally do that. It's just ...READ MORE

Dec 23, 2020 in Python by Gitika
• 65,730 points
5,261 views