Latest questions in Python

0 votes
0 answers

Extracting extension from filename in Python

Is it possible to extract the extension ...READ MORE

May 9, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 171 views
0 votes
0 answers

Immutable vs Mutable types

I'm confused on what an immutable type ...READ MORE

May 9, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 223 views
0 votes
0 answers

Which version of Python do I have installed?

On a Windows server, I need to ...READ MORE

May 9, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 180 views
0 votes
0 answers

Unable to install pandas for python

I'm attempting to install pandas for Python, ...READ MORE

May 9, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 240 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,030 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
954 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
3,168 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
961 views
0 votes
0 answers

TypeError: 'int' object is not callable

gfdfghfhg READ MORE

May 8, 2022 in Python by Kichu
• 19,040 points

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

Renaming column names in Pandas

How can  I change the column labels of ...READ MORE

May 5, 2022 in Python by Kichu
• 19,040 points
683 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,142 views
0 votes
0 answers

How can I take a message or command as user input to run a Python code

Is there any way where we can ...READ MORE

May 4, 2022 in Python by Sumana

edited Mar 4 174 views
0 votes
0 answers

Unable to install pandas for python

I am trying to install pandas for ...READ MORE

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

edited Mar 4 238 views
0 votes
0 answers

Generate random integers between 0 and 9

How can I generate random integers between ...READ MORE

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

edited Mar 4 220 views
0 votes
0 answers

Removing duplicates in lists

How do I get a new list ...READ MORE

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

edited Mar 4 208 views
0 votes
0 answers

How do I count the occurrences of a list item?

Given an item, how do I count ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 194 views
0 votes
0 answers

Is there a "not equal" operator in Python?

How would you say does not equal? Like if ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 187 views
0 votes
0 answers

Static methods in Python?

Is it possible to have static methods ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 228 views
0 votes
0 answers

What do these operators mean (** , ^ , %, //)?

Other than the standard +, -, *and / operators; but what does ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 226 views
0 votes
0 answers

How to calculate a mod b in Python?

Is there a modulo function in the ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 192 views
0 votes
0 answers

What does end=' ' exactly do?

So, I'm struggling trying to understand this ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 228 views
0 votes
0 answers

Remove 'b' character do in front of a string literal in Python 3

I am new in python programming and ...READ MORE

May 2, 2022 in Python by Edureka
• 13,690 points

edited Mar 4 208 views
0 votes
0 answers

IndentationError: unindent does not match any outer indentation level

When I compile  my python code I ...READ MORE

May 2, 2022 in Python by Kichu
• 19,040 points
1,024 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
3,664 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,944 views
0 votes
0 answers

Switching between Python 3.7 and 3.8 under Anaconda

What is the rationale for having two ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
794 views
0 votes
0 answers

How do I use method overloading in Python?

I am trying to implement method overloading ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
841 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,211 views
0 votes
0 answers

Quicksort with Python

I am totally new to python and ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
792 views
0 votes
0 answers

Python vs Cpython

What exactly is CPython and how does ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
694 views
0 votes
0 answers

If in Python I put a list inside a tuple, can I safely change the contents of that list?

The value inside the tuple is simply ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
752 views
0 votes
0 answers

What does the "yield" keyword do?

What is the use of the yield ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
564 views
0 votes
0 answers

Function for factorial in Python

How do I go about computing a ...READ MORE

Apr 26, 2022 in Python by Edureka
• 13,690 points
713 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,477 views
0 votes
1 answer

How to fix error "ERROR: Command errored out with exit status 1: python." when trying to install django-heroku using pip

Just add the package containing the executable pg_config. ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
8,350 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
5,317 views
0 votes
1 answer

EOFError: EOF when reading a line

The code: width, height = map(int, input().split()) def rectanglePerimeter(width, ...READ MORE

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

What is the difference between read() and readline() in python?

The read() will read the whole file at ...READ MORE

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

Error - could not install packages due to an oserror - [errno 2] no such file or directory

I also met with the same problem ...READ MORE

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

ValueError: could not convert string to float: id

The problem is that in your code ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
9,229 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,762 views
0 votes
1 answer

How to urlencode a querystring in Python?

Just pass your parameters into urlencode() like: >>> import urllib >>> ...READ MORE

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

How do I upgrade the Python installation in Windows 10?

If you have 2.x or 3.x version ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
860 views
+1 vote
1 answer

Unzipping files in Python

Use this code: import zipfile with zipfile.ZipFile(path_to_zip_file, 'r') as ...READ MORE

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

Spell Checker for Python

This function, in particular, has the ideas ...READ MORE

Apr 28, 2022 in Python by narikkadan
• 86,360 points
1,389 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
4,422 views
0 votes
0 answers

Python shopping cart add to cart, get total get num items

I want to loop through the list ...READ MORE

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

Print series of prime numbers in python

I want to print a series of ...READ MORE

Apr 25, 2022 in Python by Kichu
• 19,040 points
869 views