Most viewed questions in Python

0 votes
1 answer

Is it possible to break a long line to multiple lines in Python?

Example of implicit line continuation: a = some_function( ...READ MORE

Jan 4, 2021 in Python by Gitika
• 65,910 points
1,026 views
–1 vote
1 answer

Playing with Lists in Python

Hey @Fez, you can try something like ...READ MORE

May 28, 2019 in Python by Thanisha
1,026 views
0 votes
1 answer

Error:django-debug-toolbar breaking on admin while getting sql stats

Hello @kartik, You just need to be able ...READ MORE

Jun 12, 2020 in Python by Niroj
• 82,880 points
1,024 views
0 votes
1 answer

can not decompress lz4 bytes in python

We need an Minimal, Complete, and Verifiable example to ...READ MORE

Oct 4, 2018 in Python by Priyaj
• 58,090 points
1,024 views
0 votes
1 answer

I want to generate Fibonacci sequence of 100 numbers in Linked list and then reverse in python

Hey,  You can go through the given example ...READ MORE

Oct 12, 2020 in Python by Gitika
• 65,910 points
1,023 views
0 votes
0 answers

how to create dataframes with nifi

Mar 13, 2020 in Python by pavankumar
• 140 points
1,023 views
0 votes
1 answer

Parse JSON in Python

import json data=json.loads(employee_data) print(data) READ MORE

Apr 26, 2018 in Python by aayushi
• 750 points
1,021 views
0 votes
1 answer

How to install python

@Akanksha if you are new to python, ...READ MORE

Feb 28, 2019 in Python by Anvi
• 14,150 points
1,019 views
0 votes
1 answer

Why is reading lines from stdin much slower in C++ than Python?

tl;dr: Because of different default settings in ...READ MORE

Dec 18, 2020 in Python by Nikita
1,018 views
+1 vote
3 answers

What are the ways of detecting outliners in Python

code from http://eurekastatistics.com/using-the-median-absolute-deviation-to-find-outliers  This uses the L1 distance ...READ MORE

Aug 24, 2018 in Python by eatcodesleeprepeat
• 4,710 points

reshown Aug 24, 2018 by Priyaj 1,017 views
0 votes
1 answer

How do you make a higher order function in Python?

You have two choices to create higher-order ...READ MORE

Jul 25, 2019 in Python by Yesha
1,016 views
0 votes
1 answer

How to convert a Unicode string to string

It can be done in the following ...READ MORE

Oct 16, 2018 in Python by SDeb
• 13,300 points
1,015 views
+1 vote
1 answer

How to estimate number of clusters through EM in scikit-learn

For future reference, the fixed function looks ...READ MORE

Sep 26, 2018 in Python by Priyaj
• 58,090 points
1,014 views
0 votes
1 answer
0 votes
1 answer

What is list comprehension?

List comprehensions are used for creating new list from another ...READ MORE

Aug 2, 2019 in Python by Mohammad
• 3,230 points
1,011 views
0 votes
1 answer

Excel Python API

xlwt and xlrd can read and write Excel files, without ...READ MORE

Jun 7, 2019 in Python by SDeb
• 13,300 points
1,011 views
0 votes
1 answer

Exclusive values from two Sets in Python

There is a direct function available to ...READ MORE

Mar 27, 2019 in Python by Mugdha
• 600 points
1,011 views
0 votes
1 answer

Add string in a certain position

Python Strings are immutable. >>> s='355879ACB6' >>> s[4:4] = ...READ MORE

Feb 20, 2019 in Python by SDeb
• 13,300 points
1,011 views
+1 vote
6 answers

How python trim works

You want strip(): myphrases = [ " Hello ...READ MORE

Oct 18, 2018 in Python by up4rescue
1,009 views
0 votes
0 answers

convert following json to csv using recursively

{  "name": "flare",  "children": [   {    "name": "analytics",    "children": [     {      "name": "cluster",      "children": [       {"name": ...READ MORE

Oct 18, 2019 in Python by ÂbhIshëk
• 120 points
1,008 views
+2 votes
4 answers

python 2d array

You should make a list of lists, ...READ MORE

Oct 18, 2018 in Python by ritu
1,008 views
0 votes
0 answers

But when I run this, I get NameError: name 'alphabeta' is not defined error. How to solve this?

tree = [[[5, 1, 2], [8, -8, ...READ MORE

Sep 6, 2020 in Python by MUHAMMAD
• 160 points

retagged Sep 7, 2020 by Gitika 1,007 views
0 votes
1 answer

Time delay in Python

The following code will delay it for ...READ MORE

Oct 4, 2018 in Python by SDeb
• 13,300 points
1,007 views
+3 votes
2 answers

How do I install pip on Windows?

pip is already installed if you are ...READ MORE

Nov 2, 2018 in Python by Priyaj
• 58,090 points
1,005 views
0 votes
1 answer

How to check if a given string matches a particular pattern in Python?

You can use re module of python ...READ MORE

Jul 3, 2019 in Python by Neel
• 3,020 points
1,004 views
0 votes
1 answer

How to slice an array using python numpy? Is there any numpy tutorial which has covered all its operations?

Slicing is basically extracting particular set of ...READ MORE

Apr 24, 2018 in Python by Christine
• 15,790 points
1,004 views
0 votes
1 answer

How to evaluate a soft Voting classifier being trained on some data

VotingClassifier does not have a best_score_ attribute. ...READ MORE

Sep 6, 2018 in Python by Priyaj
• 58,090 points
1,003 views
0 votes
1 answer

Speeding up a numpy loop

You are allocating 10000 lists of size ...READ MORE

Mar 15, 2019 in Python by SDeb
• 13,300 points
1,002 views
0 votes
1 answer

Extract element from a set without removing it

Use iter(): element = next(iter(set_1)) READ MORE

Jun 7, 2018 in Python by Hamartia's Mask
• 1,580 points
1,002 views
0 votes
1 answer

How do I install pip on macOS or OS X?

All you have to do is: sudo easy_install ...READ MORE

Sep 11, 2020 in Python by Ahmad Awais
1,000 views
+4 votes
6 answers

Substring search in Python

Use the "in" operator in python" if "substring" ...READ MORE

Apr 13, 2018 in Python by Nietzsche's daemon
• 4,260 points
1,000 views
0 votes
1 answer

ImportError: No module named toolkit.interface

I think you didn't set your python ...READ MORE

Apr 22, 2020 in Python by MD
• 95,440 points
997 views
0 votes
1 answer

python dynamic class names

You can try the following code: classmap = ...READ MORE

May 23, 2019 in Python by ana1504.k
• 7,910 points
996 views
0 votes
1 answer

Unique identification for data items in Python

Try the UUID module of Python. For example, ...READ MORE

Apr 17, 2018 in Python by Nietzsche's daemon
• 4,260 points
995 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
995 views
0 votes
0 answers

Operands Could not be Broadcast with Shapes (19,)(0,) — KNN

I am working on how to use ...READ MORE

Nov 10, 2019 in Python by sam
• 120 points
994 views
0 votes
1 answer

Transpose list of lists

You can try the following and see ...READ MORE

Mar 2, 2019 in Python by SDeb
• 13,300 points
994 views
0 votes
1 answer

Why feed_dict is constructed when running epoch in PTB tutorial on Tensorflow?

Q1. feed_dict is used in this case to set ...READ MORE

Oct 8, 2018 in Python by Priyaj
• 58,090 points
994 views
0 votes
1 answer

Where can I find the error logs of nginx, using FastCGI and Django?

Hello @kartik, Errors are stored in the nginx ...READ MORE

Aug 6, 2020 in Python by Niroj
• 82,880 points
990 views
0 votes
1 answer

How to import other Python files?

Just import file without the '.py' extension. You can mark ...READ MORE

Nov 26, 2020 in Python by Gitika
• 65,910 points
989 views
0 votes
2 answers

what is a class method in python?

Class Method  class method is the method which is ...READ MORE

Apr 8, 2019 in Python by MrBoot
• 1,190 points
989 views
0 votes
1 answer

Create a SQL table from a Pandas DataFrame.

Hi@akhtar, You can use the Sqlalchemy module to ...READ MORE

Jun 26, 2020 in Python by MD
• 95,440 points
987 views
+1 vote
0 answers

Sum the values of column matching and not matching from a .txt file and write output to a two different files using Python

Name                                                    value DR_CNDAOFSZAPZP_GPFS_VOL.0 139264 DR_CNDAOFSZAPZP_GPFS_VOL.1 15657 DR_CNDAOFSZAPZP_GPFS_VOL.0 139264 DR_CNDAOFSZAPZP_GPFS_VOL.1 156579 DR_CNDAOFSZAPZP_GPFS_VOL.2 156579 DR_CNDAOFSZAPZP_GPFS_VOL.3 ...READ MORE

Nov 20, 2019 in Python by Sagar
• 130 points
985 views
0 votes
1 answer

Example to using pytype

Hey, here's an example that I found ...READ MORE

Jun 7, 2019 in Python by Alia
985 views
0 votes
1 answer

Install PIP on Python 3.6

pip is bundled with Python > 3.4 On Unix-like ...READ MORE

Nov 12, 2018 in Python by Priyaj
• 58,090 points
985 views
0 votes
1 answer

IndentationError: expected an indented block

Hi, @Baker, Putting in extra space or leaving ...READ MORE

Oct 19, 2020 in Python by Gitika
• 65,910 points
983 views
+1 vote
1 answer

How to install a module in Python 3.6 ?

If you are using Ubuntu then the ...READ MORE

Jun 25, 2019 in Python by Arvind
• 3,040 points
983 views
0 votes
1 answer

Python Print lines for the closest timestamp of the event

Try this: import re import os import datetime from datetime import ...READ MORE

Jan 2, 2019 in Python by Omkar
• 69,230 points
983 views
0 votes
2 answers

How do I copy a file in python?

copy a file in python  from shutil ...READ MORE

Mar 27, 2019 in Python by rajesh
• 1,270 points
981 views
–1 vote
1 answer

Python convert excel file to csv

Here you go: import glob path_to_excel_files = glob.glob('path/to/excel/files/*.xlsx') for ...READ MORE

Feb 8, 2019 in Python by Omkar
• 69,230 points
980 views