Trending questions in Python

0 votes
1 answer

How to set value for particular cell in pandas DataFrame using index?

Why df.xs('C')['x']=10 does not work: df.xs('C') by default, returns a new ...READ MORE

Jan 5, 2021 in Python by Gitika
• 65,730 points
• 4,926 views
0 votes
3 answers

How do I use raw_input in Python 3?

raw_input() was renamed to input() in Python 3. Another example ...READ MORE

Jan 4, 2021 in Python by Carlos
• 4,839 views
0 votes
1 answer
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 • 610 views
0 votes
1 answer

How to compare two JSON objects with the same elements in a different order equal?

Hello @kartik, If you want two objects with ...READ MORE

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

No 'Id' in the results of the Orderdict although id field is present in the serializers in Django Rest Framework

I tried to create an update api ...READ MORE

Apr 11, 2021 in Python by anonymous

edited Mar 4, 2025 • 652 views
0 votes
0 answers

I have a SQS queue when message arrives into queue needs to trigger lamda function and send mail to respective customer

S3 --> SQS --S3 Transfer I need to ...READ MORE

Apr 12, 2021 in Python by JAKIR

edited Mar 4, 2025 • 575 views
0 votes
1 answer

How to Install Python packages from local file system folder to virtualenv with pip?

Hello @kartik, You can try the code below: pip ...READ MORE

May 12, 2020 in Python by Niroj
• 82,800 points

edited Oct 7, 2021 by Sarfaraz • 14,987 views
0 votes
1 answer

How to convert CSV file to JSON file using Pandas?

Hi@akhtar, You can convert your CSV file to ...READ MORE

Jun 25, 2020 in Python by MD
• 95,460 points
• 13,022 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,050 points
• 26,891 views
0 votes
1 answer

Python and pip, list all versions of a package that's available?

The script at Pastebin does work. However, ...READ MORE

Nov 22, 2020 in Python by Gitika
• 65,730 points
• 6,539 views
0 votes
1 answer

How to disable a method in a ViewSet, django-rest-framework

Hello @kartik, You could keep using viewsets.ModelViewSet and define http_method_names on your ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,800 points
• 12,980 views
0 votes
1 answer

How to perform HTML decoding/encoding using Python/Django?

Hello, For html encoding, there's cgi.escape from the standard library: >> ...READ MORE

May 7, 2020 in Python by Niroj
• 82,800 points
• 15,127 views
0 votes
1 answer

Error: No module named 'django.core.urlresolvers'

Hello @kartik, If you want to import reverse, ...READ MORE

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

speech_recognition modulehas not working "audio = r.listen(source)" function.how to make it work?

def command1():          r=sr.Recognizer()     with sr.Microphone() as source:         print(random.choice(m))         r.puase_thresshold=1         sound=r.listen(source)     try:         com =r.recognize_google(sound,language='en-in')         print('user:'+ com ...READ MORE

Apr 7, 2021 in Python by python

edited Mar 4, 2025 • 668 views
0 votes
1 answer

React native for frontend and python is for backend app development it is possible??

Hello @Rithika , Yes, it is possible. For example, you ...READ MORE

Oct 30, 2020 in Python by Niroj
• 82,800 points
• 7,458 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi • 8,763 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
• 27,171 views
0 votes
1 answer

How do I install a Python package with a .whl file?

I just used the following which was ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,730 points
• 6,486 views
0 votes
0 answers

how do i Itterate trough a dictionary for a specific key, then ading it to a new dictionary

i know this is a noob question ...READ MORE

Apr 7, 2021 in Python by Said

edited Mar 4, 2025 • 589 views
0 votes
1 answer

Error is '<' not supported between instances of str and int

your dis is obviously not 1.13, it's ...READ MORE

Nov 15, 2020 in Python by Gitika
• 65,730 points
• 6,668 views
0 votes
1 answer

What is the purpose of ​#!/usr/bin/python​on the first line in the above code?

Hey, @Roshni, By specifying #!/usr/bin/python you specify exactly ...READ MORE

Jun 23, 2020 in Python by Gitika
• 65,730 points
• 12,928 views
0 votes
0 answers

How to save a file to particular folder using selenium webdriver Chrome?

I'm using selenium webdriver for chrome. My ...READ MORE

Apr 6, 2021 in Python by Pushpa

edited Mar 4, 2025 • 566 views
0 votes
2 answers

what path should I give to the url for showing a pop up when clicking on "more info" button in django?

I think u can use the bootstrap ...READ MORE

Dec 29, 2020 in Python by Carlos
• 4,682 views
0 votes
0 answers

How to solve the error of Cant execute the script.

Hey!, I am new to python i ...READ MORE

Mar 31, 2021 in Python by anonymous

edited Mar 4, 2025 • 672 views
0 votes
1 answer

How to send a correct authorization header for basic authentication

Hello @kartik, Here is how to do Basic ...READ MORE

Aug 13, 2020 in Python by Niroj
• 82,800 points
• 10,543 views
0 votes
0 answers

How to fix AttributeError: 'Turtle' object has no attribute 'xcore'

# setting up the screen import turtle import math wn ...READ MORE

Mar 30, 2021 in Python by Dembabe

edited Mar 4, 2025 • 625 views
0 votes
1 answer

Import error: No module name urllib2

As stated in the urllib2 documentation: The urllib2 module has been split ...READ MORE

May 11, 2020 in Python by Niroj
• 82,800 points
• 14,529 views
0 votes
0 answers

How can store list of id in foreign key django ?

I am trying to store multiple product ...READ MORE

Mar 27, 2021 in Python by usman

edited Mar 4, 2025 • 742 views
0 votes
1 answer

How do I update pip itself from inside my virtual environment?

Hello, pip is just a PyPI package like any other; you ...READ MORE

Nov 20, 2020 in Python by Niroj
• 82,800 points
• 6,182 views
0 votes
1 answer

How to get the latest file in a folder using python?

Hello @kartik,  would suggest using glob.iglob() instead of the glob.glob(), as ...READ MORE

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

What is `related_name` used for in Django?

Hello @kartik, The related_name attribute specifies the name of the ...READ MORE

Jun 26, 2020 in Python by Niroj
• 82,800 points
• 12,471 views
0 votes
1 answer

Everything in python is object?

In object-oriented programming languages like Python, an ...READ MORE

Jul 30, 2021 in Python by Rachana priyadarshni samal

edited Mar 5, 2025 • 1,559 views
0 votes
2 answers

Deleting DataFrame row in Pandas based on column value

Pandas provide data analysts a way to ...READ MORE

Jan 4, 2021 in Python by Nikita
• 4,067 views
0 votes
0 answers

how can I fix this problem AttributeError: '<invalid type>' object has no attribute 'title' on line 11 in main.py

The section I'm having trouble with is ...READ MORE

Mar 25, 2021 in Python by anonymous

edited Mar 4, 2025 • 685 views
0 votes
1 answer

How to avoid missing module docstring in pylint?

Either write your docs or use a ...READ MORE

Nov 6, 2020 in Python by anonymous
• 65,730 points
• 6,633 views
0 votes
1 answer

Importing files from different folder in python.

By default, you can't. When importing a ...READ MORE

Dec 20, 2020 in Python by Nikita
• 4,757 views
0 votes
1 answer

Running shell command and capturing the output

Modern versions of Python (3.5 or higher): run If ...READ MORE

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

How to save a Pandas Dataframe to a pickle file?

Hi@akhtar, Python pickle module is used for serializing ...READ MORE

Oct 18, 2020 in Python by MD
• 95,460 points
• 7,441 views
0 votes
0 answers

error install mysqlclient on windows

i have that error (dont find answer) ...READ MORE

Feb 7, 2021 in Python by anonymous
• 120 points
• 2,622 views
0 votes
1 answer

How to return custom JSON in Django REST Framework?

Hello @kartik, There are 2 ways to custom ...READ MORE

Jun 25, 2020 in Python by Niroj
• 82,800 points
• 12,342 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,960 points
• 26,625 views
0 votes
1 answer

how do i print only the last two letters in a string using regular expression in python?

S1="string1" S1[-2::] Output: g1 READ MORE

Jan 5, 2023 in Python by anonymous

edited Mar 5, 2025 • 2,424 views
0 votes
0 answers

How to read file and match string from content and then download S3 file

I have multiple files in an S3 ...READ MORE

Mar 24, 2021 in Python by Shivam

edited Mar 4, 2025 • 553 views
0 votes
1 answer

Error:django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb

Hello @kartik, It looks like you don't have ...READ MORE

Jun 24, 2020 in Python by Niroj
• 82,800 points
• 12,299 views
0 votes
1 answer

Error like “Your CPU not supported AVX , AVX2”

Cpu avx2 nahi hai kiya kare READ MORE

May 31, 2021 in Python by anonymous

edited Mar 5, 2025 • 2,443 views
0 votes
1 answer

how to solve the error : "ImportError: No module named Tkinter" in python.

Hi@Umama, If you are using Linux system, then ...READ MORE

Apr 27, 2020 in Python by MD
• 95,460 points
• 15,629 views
0 votes
0 answers

python please help, I'm getting max_X not defined

from sklearn.model_selection import cross_val_score max_k = 100 cv_scores = ...READ MORE

Mar 22, 2021 in Python by anonymous

edited Mar 4, 2025 • 579 views
0 votes
1 answer

How to invoke a function on an object dynamically by name?

Use "getattr":  obj = MyClass() try: ...READ MORE

Dec 3, 2020 in Python by Gitika
• 65,730 points
• 5,204 views