Trending questions in Python

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
15,888 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 361 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
10,768 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 298 views
0 votes
1 answer
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,194 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 290 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,428 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
6,974 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,027 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
10,673 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 414 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,197 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
5,884 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
12,328 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 337 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
14,459 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,117 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 359 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
26,424 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,223 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
3,753 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
5,725 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 362 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,039 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
5,650 views
+4 votes
7 answers

Splitting a List into chunks in Python

Here's a generator that yields the chunks ...READ MORE

Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
37,220 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,105 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
9,916 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 291 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,246 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,298 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
13,853 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 305 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,115 views
0 votes
0 answers

HOW TO SOLVE - Found input variables with inconsistent numbers of samples: [2285, 762] ERROR

import pandas as pd import numpy as np df ...READ MORE

Mar 19, 2021 in Python by Manu

edited Mar 4, 2025 369 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
11,802 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
25,664 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
3,397 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
11,742 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
3,709 views
0 votes
0 answers

how to install PyAudio???

hi, I'm working on a project and ...READ MORE

Mar 18, 2021 in Python by Modern

edited Mar 4, 2025 307 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
11,759 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
4,739 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
12,926 views
0 votes
1 answer

Error: Catch a thread's exception in the caller thread in Python

The problem is that thread_obj.start() returns immediately. The child ...READ MORE

Nov 2, 2020 in Python by Gitika
• 65,730 points
6,023 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 1,782 views
0 votes
0 answers

Hi Guys, I am trying to import matplotlib in my system. But it is showing me the below error.

import matplotlib Traceback (most recent call last):   File "<pyshell#0>", ...READ MORE

Mar 10, 2021 in Python by Dharmendra

edited Mar 4, 2025 512 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 1,823 views