Most viewed questions in Python

+1 vote
6 answers

How to fix this? ValueError: invalid literal for int() with base 10 error in Python

Hey, I tried to look for a few ...READ MORE

2 days ago in Python by keshav
93,735 views
+5 votes
6 answers

What exactly is the function of random.seed() in python?

The seed method is used to initialize the ...READ MORE

Oct 29, 2018 in Python by Rahul
78,430 views
+2 votes
11 answers

How to print array/ list without brackets in python?

print(*names, sep = ', ') This is what ...READ MORE

Dec 10, 2018 in Python by Sudo
73,879 views
0 votes
3 answers

In Python, what is difference between Array and List?

Lists and arrays are used in Python ...READ MORE

Mar 15, 2019 in Python by Taj
• 1,060 points

edited Mar 18, 2019 by Omkar 64,885 views
+1 vote
2 answers

How to change/update cell value in Python Pandas dataframe?

You can use the at() method to ...READ MORE

Apr 8, 2019 in Python by Kunal
58,963 views
+1 vote
1 answer

How can I use python to execute a curl command?

For sake of simplicity, maybe you should ...READ MORE

Oct 11, 2018 in Python by charlie_brown
• 7,770 points
45,294 views
+1 vote
3 answers

Python error "ERROR: Could not find a version that satisfies the requirement PyQt4 (from versions: none)"

You cannot install PyQt directly from pip. ...READ MORE

Jul 22, 2019 in Python by Bob
38,016 views
+1 vote
1 answer

Python: UnicodeDecodeError: "utf-8" codec can"t decode byte 0xa0 in position 10: invalid start byte

You have to use the encoding as latin1 ...READ MORE

Jul 11, 2019 in Python by Ritu
36,689 views
+1 vote
1 answer

UnicodeDecodeError: "utf-8" codec can't decode byte in position : invalid start byte

You have to use the encoding as latin1 ...READ MORE

Jul 23, 2019 in Python by Kunal
36,198 views
0 votes
1 answer

How to get the return value from a thread using python?

You don't need to change your existing ...READ MORE

Dec 3, 2018 in Python by Nymeria
• 3,540 points

edited Dec 19, 2018 by Nymeria 33,410 views
0 votes
1 answer

Python Pandas error: AttributeError: 'DataFrame' object has no attribute 'rows'

There is no attribute called “rows”. The ...READ MORE

Mar 28, 2019 in Python by Shri
32,466 views
0 votes
1 answer

Python exit commands - why so many and when should each be used?

Let me give some information on them: quit ...READ MORE

Aug 27, 2018 in Python by Priyaj
• 57,530 points
31,870 views
0 votes
1 answer

Python Pandas: ValueError: DataFrame constructor not properly called!

The syntax is not right. The right ...READ MORE

Mar 28, 2019 in Python by Ritu
28,319 views
+1 vote
4 answers

What do you mean by python scripting? What is a script and a module in python?

A module is a file containing a ...READ MORE

Jun 17, 2019 in Python by Zain Abbas
27,938 views
0 votes
2 answers

Python error "IndentationError: expected an indented block"

Putting in an extra space or leaving ...READ MORE

Mar 2 in Python by evanbung
• 180 points
25,676 views
0 votes
1 answer

How to print objects of class using print function in Python?

It can be done as shown below: class Element: ...READ MORE

Dec 3, 2018 in Python by Nymeria
• 3,540 points

edited Dec 19, 2018 by Nymeria 23,839 views
+1 vote
2 answers

How to install tkinter in pycharm?

Ya, this is a problem with installing ...READ MORE

Apr 3, 2019 in Python by Jishan
22,771 views
0 votes
1 answer

TypeError: unsupported operand type(s) for -: 'str' and 'str'

Hi. This error is caused because you ...READ MORE

May 12, 2019 in Python by Anjali
22,437 views
0 votes
1 answer

How to find the index of a particular value in a dataframe?

First, use the dataframe to match the ...READ MORE

Apr 8, 2019 in Python by Esha
22,379 views
0 votes
3 answers

Python error "NameError: name 'sr' is not defined"

NameError: name 'xx' is not defined Python knows ...READ MORE

Mar 19 in Python by rahul
• 360 points
21,205 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
21,061 views
0 votes
2 answers

How to use not equal operator in python

You can use "!=" and "is not" ...READ MORE

Mar 17 in Python by rahul
• 360 points
20,965 views
0 votes
2 answers

Extracting data from a JSON file in Python

Here is what i found and was ...READ MORE

Nov 27, 2018 in Python by Rupali
20,838 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,540 points
20,387 views
0 votes
1 answer

how to exit a python script in an if statement

This works fine for me: while True: ...READ MORE

Sep 19, 2018 in Python by bug_seeker
• 15,390 points
19,413 views
+2 votes
2 answers

How can I replace values with 'none' in a dataframe using pandas

Actually in later versions of pandas this ...READ MORE

Aug 13, 2018 in Python by bug_seeker
• 15,390 points
19,023 views
0 votes
3 answers

How can I use grep in Python?

Hello,  Here goes a short demonstration on How ...READ MORE

2 days ago in Python by Nagaraj

edited 1 day ago 18,755 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

Nov 12, 2018 in Python by Nymeria
• 3,540 points
18,515 views
+1 vote
1 answer

Python: convert txt file to csv format with rows and columns

This code should work. You have to ...READ MORE

Aug 1, 2019 in Python by Ashish
18,470 views
0 votes
2 answers

How do I remove an element from a list by index in Python?

Delete the List and its element: We have ...READ MORE

Jun 7 in Python by sahil
• 500 points
18,295 views
0 votes
1 answer

How can I check for NaN in Python?

math.isnan() Checks if the float x is a ...READ MORE

Aug 16, 2018 in Python by Priyaj
• 57,530 points
18,053 views
0 votes
11 answers

“pip install unroll”: “python setup.py egg_info” failed with error code 1

rm -rf node_modules READ MORE

Jun 27, 2019 in Python by anonymous
17,758 views
0 votes
3 answers

TypeError: Index(...) must be called with a collection of some kind, 'Email' was passed

It is not working because your code ...READ MORE

May 12 in Python by anonymous

edited May 13 by Gitika 17,418 views
+2 votes
1 answer

ModuleNotFoundError: No module named 'Crypto'

The module you’ve installed is different. To install ...READ MORE

Aug 20, 2019 in Python by Raman
15,534 views
0 votes
2 answers

How to read Pandas csv file with no header?

Use this logic, if header is present ...READ MORE

Mar 14 in Python by Shahabuddin
• 140 points
14,107 views
0 votes
3 answers

Python pandas: TypeError: tuple indices must be integers or slices, not str

In fact, I get a perfectly good ...READ MORE

Jun 13, 2019 in Python by Alok
13,867 views
+1 vote
1 answer

How to print one pandas column without index?

There is a slight mistake in what ...READ MORE

Mar 28, 2019 in Python by Shri
13,134 views
0 votes
1 answer

How to replace negative numbers in Pandas Data Frame by zero?

If all your columns are numeric, you ...READ MORE

Jul 8, 2019 in Python by SDeb
• 13,250 points
12,617 views
0 votes
1 answer

Python TypeError: 'list' object is not callable.

The error says the list is not ...READ MORE

Feb 8, 2019 in Python by Omkar
• 69,040 points
12,575 views
0 votes
1 answer

Python error "TypeError: string indices must be integers, not str"

Hey @Dipti email_s.append(email_1["email_address"]) This is the list on ...READ MORE

Jul 5, 2019 in Python by Jinu
12,522 views
0 votes
2 answers

NameError: name 'raw_input' is not defined

Hi, There may a problem with your python ...READ MORE

Jun 25 in Python by MD
• 31,430 points
12,473 views
+1 vote
1 answer

How to check if a string is null in python

Try this: if cookie and not cookie.isspace(): # the ...READ MORE

Aug 20, 2018 in Python by Priyaj
• 57,530 points
12,304 views
0 votes
3 answers

what is the difference between append and insert in python lists?

There is a simple difference between append ...READ MORE

Jun 22, 2019 in Python by Harshdeep Khatke
12,070 views
+1 vote
4 answers

How to write nested dictionaries to a CSV file

Using DictWriter there is no need in ...READ MORE

Oct 18, 2018 in Python by Richard William
11,866 views
0 votes
2 answers

How do play audio (playsound) in background of Python script?

There’s an optional second argument, block, which ...READ MORE

Jun 7, 2019 in Python by anonymous
11,770 views
0 votes
1 answer

Create a constant in Python?

No there is not. You cannot declare ...READ MORE

Aug 24, 2018 in Python by Priyaj
• 57,530 points
11,565 views
0 votes
1 answer

How to install modules in Pycharm?

You can install modules in PyCharm using ...READ MORE

May 30, 2019 in Python by Shabnam
• 920 points
10,828 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
10,671 views
0 votes
1 answer

Python Error ""ValueError: could not broadcast input array from shape (4) into shape (1000)""

There are better ways of achieving the ...READ MORE

Jun 13, 2019 in Python by Faiza
9,916 views
0 votes
1 answer

Pandas - FillNa with another column

You can provide this column to fillna, it ...READ MORE

Jul 5, 2019 in Python by SDeb
• 13,250 points
9,864 views