Trending questions in Python

0 votes
1 answer

Python function to find a list of all keywords

You can use the keyword module for ...READ MORE

Jun 17, 2019 in Python by Ayman
8,602 views
0 votes
1 answer

flush parameter of print in Python

Usually all I/Os are buffered, meaning they ...READ MORE

Jul 30, 2019 in Python by Wajiha
• 1,950 points
6,660 views
0 votes
1 answer

Closest value and its index in a sorted list - Python

You can try this @Mahesh: lst = [ ...READ MORE

May 28, 2019 in Python by Sai
9,325 views
0 votes
4 answers

How to write a single program in python to print different '*' triangles?

If you want to use the same ...READ MORE

Jun 11, 2019 in Python by Likhith
8,664 views
+1 vote
2 answers

How to automate image upload from my computer to site using python-selenium?

Hey, this code worked for me: image_path=os.path.abspath('.\\folder1\\subfolder2\file1.jpg') driver.find_element_by_id("Id of ...READ MORE

Aug 19, 2019 in Python by Rishi
5,702 views
0 votes
1 answer

Now able to open multiple windows: selenium.common.exceptions.WebDriverException: invalid session id

You have initialized driver only once and ...READ MORE

Apr 6, 2019 in Python by James
11,448 views
+1 vote
1 answer

how do i get a optimal cutoff value(directly in the form of numeric) from roc curves?

The optimal CutOff value is the point ...READ MORE

Oct 17, 2019 in Python by Saira
2,999 views
0 votes
1 answer

Python Pandas: KeyError: False

The reason for this error is that ...READ MORE

May 8, 2019 in Python by Jimmy
9,993 views
+1 vote
1 answer
+1 vote
1 answer

How to save a bitmap or vector graphics image after creating a drawing with python's turtle module.

This worked for me: from Tkinter import * from ...READ MORE

Jul 6, 2019 in Python by Kyraa
7,437 views
0 votes
1 answer

How to input optional arguments in python command line?

Please use this code. if len(sys.argv) == 2: first_log ...READ MORE

Jul 11, 2019 in Python by Suri
7,165 views
0 votes
1 answer

how to convert date field into UTC format (2019-10-29T19:20:30.45Z)

Hey, I think this should do what ...READ MORE

Oct 29, 2019 in Python by Niharika
2,404 views
0 votes
1 answer

Add header row in pandas dataframe while printing

Refer to this code: import pandas as pd col_name=['Name', ...READ MORE

Jul 5, 2019 in Python by Suri
7,351 views
+1 vote
1 answer

How do I use the data of an array after splitting it?

Hey, You can use  np.greater(b, f) np.greater_equal(b, f) np.less(b, f) np.less_equal(b, ...READ MORE

Dec 9, 2019 in Python by Payal
532 views
0 votes
1 answer

How to create LIST from CSV file in Python?

You can use the pandas library for this which ...READ MORE

Jul 15, 2019 in Python by Karan
6,890 views
+1 vote
0 answers

I have to write 2 triangles in one raw (python)

I have two triangles that has to ...READ MORE

Dec 4, 2019 in Python by מיקה
• 130 points
709 views
0 votes
1 answer

How to write inline if statement for print in Python?

Inline if-else expression must always contain the else ...READ MORE

Dec 4, 2018 in Python by Nymeria
• 3,560 points

edited Dec 6, 2018 by Nymeria 16,438 views
0 votes
1 answer

Python error "'str' object has no attribute 'turtle' in Python turtle"

There is a syntax error. Change the ...READ MORE

Jul 9, 2019 in Python by Pallavi
7,079 views
+1 vote
0 answers

How to close a window, and then reinitialize it using PyQt

There is a button "btn_closeWin_and_reinit"  in the ...READ MORE

Jul 10, 2019 in Python by marceepoo
• 130 points

edited Jul 22, 2019 by Kalgi 7,008 views
0 votes
1 answer

How can I use the sleep function in a python program?

You can use sleep as below. import time print(" ...READ MORE

Jun 10, 2020 in Python by anonymous
784 views
+1 vote
1 answer

How can I delete a file in Python IDLE?

Hey @Starsarwar You have two different codes, they ...READ MORE

Oct 28, 2019 in Python by Kalgi
• 52,360 points
2,148 views
0 votes
1 answer

converting timedelta to float

Use the following piece of code: x1=datetime.timedelta(days=3000, seconds=0, ...READ MORE

Aug 8, 2019 in Python by Wajiha
• 1,950 points
5,628 views
0 votes
2 answers

Change the default indexing of an array in pandas

df = pd.DataFrame({'month': [1, 4, 7, 10],                    'year': ...READ MORE

Nov 28, 2019 in Python by nagendra reddy
932 views
0 votes
1 answer

Plot a pie-chart in Python in Matplotlib

Not sure which dataset you are using. ...READ MORE

Jul 22, 2019 in Python by Shri
6,281 views
0 votes
0 answers

I am trying to click the button but it is not working and it is drop list ..

<a class="quickreports btn btn3d tbbtn" href="javascript:" style="position:static" ...READ MORE

Dec 2, 2019 in Python by anonymous
• 120 points
594 views
0 votes
1 answer

Python error "ZeroDivisionError: division by zero"

Catch the error and handle it: try: ...READ MORE

May 31, 2019 in Python by Rhea
8,495 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
977 views
0 votes
2 answers

Difference between sort and sorted

when to use which? Use list.sort when you ...READ MORE

Mar 26, 2020 in Python by rahul
• 360 points
4,357 views
0 votes
2 answers

Explain OOPs concept in python with programatic examples

OOP reflects the real world behavior of ...READ MORE

Jun 24, 2020 in Python by rahul
• 360 points
1,532 views
+2 votes
0 answers

I don't want to seem like a begger, but I've been working on this code for the past 3 days and made 0 progress.

Basically, my code runs a turtle and ...READ MORE

Nov 26, 2019 in Python by Kyler
• 140 points
659 views
0 votes
1 answer

input() vs sys.stdin.read()

If you're on Windows, you'll notice that ...READ MORE

Jul 23, 2019 in Python by SDeb
• 13,300 points
6,099 views
0 votes
1 answer

How to I clear Tkinter Canvas using Python?

To clear a canvas, use the delete method.  This ensures ...READ MORE

Dec 24, 2018 in Python by Nymeria
• 3,560 points
15,187 views
+1 vote
2 answers

how can i do a binary search in python?

def Binary_search (array , element):       ...READ MORE

Jul 10, 2020 in Python by anonymous
• 240 points
761 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
• 58,090 points
19,686 views
+4 votes
1 answer

Print the odd and even factors of a number in Python

x = int(input("Enter any number \n")) print("The factors ...READ MORE

Nov 19, 2018 in Python by Nabarupa
16,482 views
+1 vote
0 answers

ssh db connection using python2.7

I am supposed to use python 2.7 ...READ MORE

Nov 22, 2019 in Python by sweta
• 130 points
726 views
0 votes
1 answer

How can i import json file and encrypt it by using ASE MODE CBC encryption ?

Hi @Ahmed. Here's a sample code that ...READ MORE

Aug 20, 2019 in Python by Simran
4,793 views
0 votes
1 answer

Python: is thread still running

The key is to start the thread ...READ MORE

Aug 5, 2019 in Python by SDeb
• 13,300 points
5,409 views
+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

Mar 31, 2018 in Python by DareDev
• 6,890 points
19,358 views
0 votes
1 answer

Read Nested Json as DataFrame

Here is the code for it. da=[ {"age":34, "id":1, "name":"Tony", "salary":1400, "dept_no":[10,20], "Cntct":{"Phone":[1234567890,9876543210], "state":"NY", ...READ MORE

Jul 25, 2019 in Python by Jimmy
5,844 views
0 votes
1 answer

i am normalizing the data set iris in python and get the error ::TypeError: 'numpy.float64' object is not callable

TRY THIS   #Nomalisation for i in names:     print(i)   ...READ MORE

Aug 20, 2019 in Python by Noel Deepak Palle
5,528 views
0 votes
1 answer

How to get anchor tags of particular class using BeautifulSoup?

You can specify the class you want ...READ MORE

Apr 2, 2019 in Python by John
10,707 views
0 votes
1 answer

Handling request exceptions while using threads?

There are different places you can add ...READ MORE

Nov 4, 2019 in Python by Richard
1,287 views
0 votes
1 answer

What is the difference between print and pprint in Python?

As per the documentation,  The pprint module provides a capability ...READ MORE

Jul 8, 2019 in Python by Arvind
• 3,040 points
6,398 views
0 votes
1 answer

Pandas vs NumPy

Pandas should be used when you are ...READ MORE

Nov 18, 2019 in Python by Aman
629 views
0 votes
1 answer

Python code for printing the string without vowels using list comprehension

Hey @Anvit, you can use something like ...READ MORE

Jul 8, 2019 in Python by Rajeev
6,364 views
0 votes
1 answer

What kind of data suits pandas the most?

Pandas can handle almost all kinds of ...READ MORE

Nov 18, 2019 in Python by Eric
612 views
0 votes
1 answer

How do I create a dataframe using a dictionary in pandas?

Hi @Hannah, You need to define your dictionary ...READ MORE

Nov 18, 2019 in Python by Eric
603 views
0 votes
4 answers

What is a Tuple in Python and how to use it?

Tuples  are a  Unchanging sequence of values, ...READ MORE

Jun 21, 2020 in Python by sahil
• 580 points
1,417 views