Trending questions in Python

0 votes
0 answers

why is my syntax error? expected an indented block

class LinearModel():     def __init__(self, features, target):  self.X ...READ MORE

Jul 12, 2022 in Python by Abdulloh

edited Mar 4 137 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
2,159 views
0 votes
0 answers

Relative imports - ModuleNotFoundError: No module named x

I have these  two files: test.py config.py These are the following ...READ MORE

May 23, 2022 in Python by Kichu
• 19,040 points
2,145 views
0 votes
0 answers

ImportError: cannot import name api ,when we try to export swagger specification in python restplus

from flask import json from myapp import api urlvars ...READ MORE

Jul 8, 2022 in Python by Rakshitha

edited Mar 4 139 views
0 votes
0 answers

Open Whatsapp Windows app directly from python program using url

According to this FAQ page of Whatsapp on How to ...READ MORE

Apr 18, 2022 in Python by Edureka
• 13,680 points
1,347 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
2,748 views
0 votes
0 answers

Filter data in django before expired date

I want to show and filter  data ...READ MORE

Jul 5, 2022 in Python by Ide

edited Mar 4 127 views
0 votes
0 answers

TypeError: 'type' object is not subscriptable when indexing in to a dictionary

I use dict to shorten things as ...READ MORE

May 24, 2022 in Python by Kichu
• 19,040 points
1,703 views
0 votes
0 answers

Error in Python script "Expected 2D array, got 1D array instead:"?

I wanted to make this ML prediction: import ...READ MORE

May 18, 2022 in Python by Kichu
• 19,040 points
1,848 views
0 votes
1 answer

Plot correlation matrix using pandas

Just use pyplot.matshow() from matplotlib: import matplotlib.pyplot as plt plt.matshow(dataframe.corr()) plt.show() If df.corr() ...READ MORE

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

ImportError: No module named pip

I installed setuptools 1.0 with ez_setup.py from https://pypi.python.org/pypi/setuptools. Then ...READ MORE

May 12, 2022 in Python by Kichu
• 19,040 points
2,014 views
0 votes
0 answers

dlib installation on Windows 10

 I have the python app running great ...READ MORE

May 24, 2022 in Python by Kichu
• 19,040 points
1,528 views
0 votes
0 answers

I executed this code. But its showing me error. Could anyone fix it?

READ MORE

Jun 25, 2022 in Python by anonymous

edited Mar 4 120 views
0 votes
0 answers

No acceptable C compiler found in $PATH when installing python

I followed this post to install a ...READ MORE

May 19, 2022 in Python by Kichu
• 19,040 points
1,708 views
0 votes
0 answers

lmList, bbox = detector.findPosition(img) ValueError: not enough values to unpack (expected 2, got 0)

can anyone please help me, tried those ...READ MORE

Jun 22, 2022 in Python by Webinar

edited Mar 4 124 views
0 votes
0 answers

TypeError: 'NoneType' object is not iterable in Python

What does this error mean?  I get this ...READ MORE

May 5, 2022 in Python by Kichu
• 19,040 points
2,113 views
0 votes
0 answers

Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

 I am getting this error: Truth value of ...READ MORE

May 9, 2022 in Python by Kichu
• 19,040 points
2,003 views
0 votes
0 answers

How to input matrix (2D list) in Python?

I am working on a code that ...READ MORE

May 24, 2022 in Python by Kichu
• 19,040 points
1,345 views
0 votes
0 answers

how to merge two data frames based on particular column in pandas python?

I want to  merge two data frames: df1 company,standard tata,A1 cts,A2 dell,A3 df2 company,return tata,71 dell,78 cts,27 hcl,23 I ...READ MORE

May 26, 2022 in Python by Kichu
• 19,040 points
862 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
29,530 views
0 votes
0 answers

memory error in python

I am working on a  program that ...READ MORE

May 26, 2022 in Python by Kichu
• 19,040 points
934 views
0 votes
0 answers

ModuleNotFoundError: No module named 'sklearn'

I am using Anaconda and Python 3.6.1 ...READ MORE

May 20, 2022 in Python by Kichu
• 19,040 points
1,119 views
0 votes
0 answers

'str' object has no attribute 'decode'. Python 3 error?

Code: import imaplib from email.parser import HeaderParser conn = imaplib.IMAP4_SSL('imap.gmail.com') conn.login('example@gmail.com', ...READ MORE

May 13, 2022 in Python by Kichu
• 19,040 points
1,451 views
0 votes
0 answers

"getaddrinfo failed", what does that mean?

I am getting this error when launching ...READ MORE

May 13, 2022 in Python by Kichu
• 19,040 points
1,343 views
0 votes
0 answers

How to prettyprint a JSON file?

May 27, 2022 in Python by Kichu
• 19,040 points
803 views
0 votes
0 answers

Double the value of array on a match - Python

I want to iterate through the elements ...READ MORE

Apr 24, 2022 in Python by Kichu
• 19,040 points
2,122 views
0 votes
0 answers

Python 3 ImportError: No module named 'ConfigParser'

I want to pip - install the ...READ MORE

Apr 24, 2022 in Python by Kichu
• 19,040 points
2,167 views
0 votes
0 answers

How do I convert a datetime to date?

How do I convert a datetime.datetime object ...READ MORE

May 24, 2022 in Python by Kichu
• 19,040 points
895 views
0 votes
1 answer

Error: 'int' object is not subscriptable - Python

The issue is in the line: int([x[age1]]) The solution ...READ MORE

Apr 30, 2022 in Python by narikkadan
• 86,360 points
1,909 views
0 votes
0 answers

How can I install XGBoost package in python on Windows

I am using windows 64bit os and ...READ MORE

May 26, 2022 in Python by Kichu
• 19,040 points
798 views
0 votes
0 answers

Extract a page from a pdf as a jpeg

How can I  save a certain page ...READ MORE

May 26, 2022 in Python by Kichu
• 19,040 points
752 views
0 votes
0 answers

How to highlight cell value in dataframe that exceeds mean of its column

I have a df with where I ...READ MORE

Jun 10, 2022 in Python by Pavan

edited Mar 4 126 views
0 votes
0 answers

Python Requests get returns response code 401 for nse india website

I use this program to get the ...READ MORE

Apr 22, 2022 in Python by Edureka
• 13,680 points
2,190 views
0 votes
0 answers

Why am I getting a FileNotFoundError?

I am working on a program that ...READ MORE

May 24, 2022 in Python by Kichu
• 19,040 points
677 views
0 votes
0 answers

IndentationError: expected an indented block

this is my code  stemming = PorterStemmer() corpus = ...READ MORE

Jun 8, 2022 in Python by anonymous

edited Mar 4 124 views
0 votes
0 answers

Writing a pandas DataFrame to CSV file

I want to write a pandas data ...READ MORE

May 21, 2022 in Python by Kichu
• 19,040 points
914 views
0 votes
0 answers

How do I do a case-insensitive string comparison?

How can I do case-insensitive string comparison ...READ MORE

May 26, 2022 in Python by Kichu
• 19,040 points
693 views
0 votes
0 answers

Automate logging in to MS form using Python

I have to login into the same ...READ MORE

Apr 22, 2022 in Python by Edureka
• 13,680 points
1,981 views
0 votes
1 answer

Distance calculator

#Starting position co-ordinates - x=0 and y=0 import ...READ MORE

May 8, 2023 in Python by GS

edited Mar 5 4,932 views
0 votes
0 answers

Module 'numpy.core' has no attribute 'numerictypes' (Error)

from imageai.Detection import ObjectDetection detector = ObjectDetection() detector.setModelTypeAsTinyYOLOv3() detector.setModelPath("BrainTumor10EpochsCategorical.h5") detector.loadModel() detection = ...READ MORE

Jun 3, 2022 in Python by Abdullah Celal

edited Mar 4 140 views
0 votes
0 answers

How do I use matplotlib autopct?

I want to create a matplotlib pie ...READ MORE

Apr 24, 2022 in Python by Kichu
• 19,040 points
1,857 views
0 votes
1 answer

Simple prime number generator in Python

There are some problems with your code. You ...READ MORE

Apr 25, 2022 in Python by narikkadan
• 86,360 points
1,720 views
0 votes
0 answers

Python's equivalent of && (logical-and) in an if-statement

This is not  working : if cond1 && cond2: Can ...READ MORE

May 20, 2022 in Python by Kichu
• 19,040 points
586 views
0 votes
0 answers

How can I prevent the TypeError: list indices must be integers, not tuple when copying a python list to a numpy array?

I want to create 3 numpy arrays/lists ...READ MORE

May 7, 2022 in Python by narikkadan
• 86,360 points
1,106 views
0 votes
0 answers

Conda: Creating a virtual environment

I am trying to create a virtual ...READ MORE

May 9, 2022 in Python by Kichu
• 19,040 points
929 views
0 votes
0 answers

TypeError: 'int' object is not callable

This is the code : from __future__ import ...READ MORE

May 8, 2022 in Python by Kichu
• 19,040 points
941 views
0 votes
1 answer

Is Python strongly typed?

Python is both strongly and dynamically typed. Strongly ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
1,456 views
0 votes
1 answer

Django object is not JSON serializable

Hello @kartik, simplejson and json don't work with django objects well. Django's ...READ MORE

Aug 7, 2020 in Python by Niroj
• 82,800 points
28,563 views
0 votes
1 answer

How to generate all permutations of a list?

This solution implements a generator, to avoid ...READ MORE

May 9, 2022 in Python by Edureka
• 12,700 points

edited Mar 5 1,195 views
0 votes
0 answers

Why does "pip install" inside Python raise a SyntaxError?

I wanted to use pip to install ...READ MORE

Apr 24, 2022 in Python by Kichu
• 19,040 points
1,540 views