Most viewed questions in Python

+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
26,795 views
+2 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
25,143 views
0 votes
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,720 points
16,559 views
0 votes
1 answer

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

The following are totally acceptable in python: passing ...READ MORE

Nov 16, 2018 in Python by Nymeria
• 3,520 points
15,498 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,520 points

edited Dec 19, 2018 by Nymeria 12,094 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 in Python by anonymous
10,311 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
8,624 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,520 points
7,945 views
+1 vote
3 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 in Python by Zain Abbas
7,880 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
• 56,900 points
7,713 views
0 votes
1 answer

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

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

Apr 8 in Python by Kunal
7,363 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,520 points
6,877 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,350 points
6,676 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
6,173 views
0 votes
1 answer

How to install tkinter in pycharm?

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

Apr 3 in Python by Jishan
5,840 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
5,439 views
0 votes
2 answers

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

Did you import the module? READ MORE

Jun 4 in Python by anonymous
5,417 views
0 votes
2 answers

Manually raising (throwing) an exception in Python

Exception handling issues in python can easily ...READ MORE

Jan 18 in Python by nick
• 140 points
5,012 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
• 56,900 points
4,935 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 in Python by Shri
4,718 views
0 votes
1 answer

Python Pandas: ValueError: DataFrame constructor not properly called!

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

Mar 28 in Python by Ritu
4,712 views
0 votes
1 answer

In Python, what is difference between Array and List?

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

Mar 15 in Python by Taj
• 1,040 points

edited Mar 18 by Omkar 4,349 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 in Python by anonymous
3,915 views
0 votes
1 answer

How can I use grep in Python?

First of all, you are not iterating ...READ MORE

Dec 12, 2018 in Python by charlie_brown
• 7,720 points
3,590 views
0 votes
2 answers

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

Try: df1=pd.DataFrame(columns=['Email']) READ MORE

May 19 in Python by anonymous
3,549 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
• 56,900 points
3,497 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,350 points
3,357 views
0 votes
1 answer

ProgrammingError: not all arguments converted during string formatting

Sorted!!!! just found the solution, 1 - apparently ...READ MORE

Sep 10, 2018 in Python by Priyaj
• 56,900 points
3,322 views
0 votes
2 answers

Not able to install speech_recognition in python: ModuleNotFoundError: No module named 'speech_recognition'

The pip library is called SpeechRecognition, not ...READ MORE

Jan 24 in Python by anonymous
3,270 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 in Python by Alok
3,263 views
+1 vote
2 answers

Measuring the distance between pixels on OpenCv with Python

You can try this: Mat pts1(nPts, 1, CV_8UC2), ...READ MORE

Aug 24, 2018 in Python by Omkar
• 67,620 points
3,067 views
0 votes
1 answer

How do you get the logical xor of two variables in Python?

If you're already normalizing the inputs to ...READ MORE

May 29, 2018 in Python by ariaholic
• 7,340 points
3,046 views
0 votes
1 answer

How can I write code to find a palindrome in python without using string functions?

In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)): In ...READ MORE

Jan 16 in Python by charlie_brown
• 7,720 points
2,988 views
+1 vote
2 answers

Python convert XLS and XLSX file to csv

XLSX tables are usually created in MS ...READ MORE

Aug 30 in Python by Mian Tanzeel
2,949 views
0 votes
1 answer

Flask App Using WTForms with SelectMultipleField

Flask returns request.form as a werkzeug MultiDict ...READ MORE

Aug 22, 2018 in Python by ariaholic
• 7,340 points
2,893 views
+3 votes
1 answer

Tensorflow 1.5 ImportError: No module named tensorflow.python.client

I think it's a bug in Tensorflow ...READ MORE

Sep 25, 2018 in Python by charlie_brown
• 7,720 points
2,764 views
+2 votes
1 answer

How to install pip in windows?

Step 1:  Open the following link and go to ...READ MORE

Nov 27, 2018 in Python by Priyaj
• 56,900 points
2,679 views
+1 vote
1 answer

How to handle Real-Time Matplotlib Plotting

To draw a continuous set of random ...READ MORE

Sep 26, 2018 in Python by Priyaj
• 56,900 points
2,642 views
0 votes
1 answer

1 Year Rolling mean pandas on column date

I believe this should work for you: # ...READ MORE

Sep 6, 2018 in Python by Priyaj
• 56,900 points
2,617 views
0 votes
1 answer

How to open another window using PyQt

Switch between self.hide() and self.showMinimized() def start(self): ...READ MORE

Oct 1, 2018 in Python by Priyaj
• 56,900 points
2,610 views
+1 vote
2 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 in Python by Bob
2,548 views
0 votes
1 answer

Pyplot error "only size-1 arrays can be converted to Python scalars"

You can plot the chart by taking ...READ MORE

Jan 28 in Python by Omkar
• 67,620 points
2,430 views
0 votes
1 answer

How to convert datetime.date to UTC timestamp in Python

In Python 3 (< 3.3) From the docs ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 56,900 points
2,314 views
0 votes
1 answer

Convert HTML to an image in Python

webkit2png. The original version is OSX-only, but luckily ...READ MORE

Feb 4 in Python by SDeb
• 13,160 points
2,292 views
0 votes
1 answer

How can I reformat value_counts() analysis in Pandas for large number of columns?

If I were you, I'd do it ...READ MORE

Apr 17, 2018 in Python by anonymous
2,282 views
0 votes
1 answer

How can I parse a YAML file in Python?

Read & Write YAML files with Python ...READ MORE

Nov 21, 2018 in Python by Nymeria
• 3,520 points
2,259 views
0 votes
1 answer

How to find if a value exists in Pandas dataframe?

Try this:​ for name in df['Name']: ...READ MORE

Apr 8 in Python by Tina
2,194 views
+3 votes
5 answers

How to read multiple data files in python

Firstly we will import pandas to read ...READ MORE

Apr 6, 2018 in Python by DeepCoder786
• 1,720 points
2,163 views
0 votes
1 answer

How to print first character of each word in upper case of a string in Python

You can use split() using space as ...READ MORE

Jun 1, 2018 in Python by george
• 200 points
2,151 views
0 votes
1 answer

text = _whitespace_only_re.sub('', text) TypeError: expected string or bytes-like object

This seems like an issue with textwrap ...READ MORE

Feb 13 in Python by Omkar
• 67,620 points
2,139 views