Trending questions in Python

0 votes
1 answer

How do I use urllib to see if a website is 404 or 200 in Python?

For Python 3, try doing this: import urllib.request, ...READ MORE

Nov 29, 2018 in Python by Nymeria
• 3,560 points

edited Dec 11, 2018 by Nymeria 14,309 views
0 votes
1 answer

Python argparse error "NameError: name 'file' is not defined"

The right datatype for destination in argpasrse module ...READ MORE

Nov 28, 2018 in Python by Omkar
• 69,220 points
14,314 views
0 votes
1 answer

How to get value in Pandas dataframe using index?

You can use the iloc method to do ...READ MORE

Apr 8, 2019 in Python by Rohit
8,626 views
0 votes
1 answer

How can I change the iteration variable inside a for loop in python?

Assume you have a list of lists: my_list ...READ MORE

Jun 10, 2019 in Python by Shubham Bansal
5,897 views
0 votes
1 answer

How to remove all characters before a specific character in Python?

Use re.sub. Just match all the chars ...READ MORE

Feb 27, 2019 in Python by SDeb
• 13,300 points
10,352 views
0 votes
1 answer

How to fill Null/NaN values in Pandas Dataframe?

Pandas allows you to change all the ...READ MORE

May 13, 2019 in Python by Rajat
7,067 views
0 votes
1 answer

Make turtle face a particular direction in python

You can use the the setheading command turtle.setheading(<degrees/radians>) In ...READ MORE

Jul 8, 2019 in Python by Jinu
4,623 views
0 votes
1 answer

Create an empty tkinter window - Python

Its pretty simple: # import the module import Tkinter $Create ...READ MORE

Jul 22, 2019 in Python by Aysha
4,013 views
0 votes
1 answer

How to pass query string in url using python requests?

You can pass the key-value pairs to ...READ MORE

May 14, 2019 in Python by Likith
6,993 views
0 votes
1 answer

Python Pandas: Find length of string in dataframe

You can find the length of the ...READ MORE

May 14, 2019 in Python by Firoz
6,941 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
• 58,020 points
16,835 views
0 votes
1 answer

Difference between a normal def defined function and lambda function in python?

Have a look at this code: # Python ...READ MORE

May 20, 2019 in Python by Trisha
6,649 views
0 votes
1 answer

Writing output to new file using xml.etree.ElementTree in python

To write results to a new file, ...READ MORE

Jul 25, 2019 in Python by Wajiha
• 1,960 points
3,735 views
0 votes
1 answer

How to convert pandas dataframe to numpy array?

Irrespective of whether the dataframe has similar ...READ MORE

May 13, 2019 in Python by Rishi
6,859 views
0 votes
1 answer

What are first class objects in Python?

First-class objects in a language are handled uniformly ...READ MORE

Aug 2, 2019 in Python by Arvind
• 3,050 points
3,327 views
0 votes
1 answer

Performing divison on timedelta object in python?

Refer the following piece of code: e1=datetime.timedelta(days=32, seconds=0, ...READ MORE

Aug 13, 2019 in Python by Wajiha
• 1,960 points
2,837 views
0 votes
1 answer

Python: Both list gets affected after creating list using list2 = list1

When you are copying a list to ...READ MORE

Aug 1, 2019 in Python by Lohit
3,338 views
+2 votes
1 answer

Import zip files and process the excel files ( inside the zip files ) by using pyspark connecting with pymongo

I found this sample code: import zipfile import io def ...READ MORE

Aug 19, 2019 in Python by Reshma
2,616 views
0 votes
1 answer

Python Error "ERROR: PyQt4-4.11.4-cp27-cp27m-win32.whl is not a supported wheel on this platform."

cp27 means it's for python 2.7. Make ...READ MORE

Jul 22, 2019 in Python by Greg
3,677 views
0 votes
1 answer

What is the easiest way to concatenate two lists in Python?

You can use the + operator to combine them: list1 ...READ MORE

Sep 16, 2019 in Python by Neel
• 3,020 points
1,303 views
0 votes
1 answer

Get bbox in data coordinates in matplotlib

I'm not sure how you got the ...READ MORE

Jun 18, 2019 in Python by SDeb
• 13,300 points
5,131 views
0 votes
1 answer

Python error "_tkinter.TclError: unknown font style "Normal""

Change the line  pen.write("score: {} High Score: {}".format(score, ...READ MORE

Jul 22, 2019 in Python by Yashita
3,565 views
0 votes
1 answer

What is the purpose of else part in python exception handling?

When an error occurs, or exception as ...READ MORE

Aug 23, 2019 in Python by Arvind
• 3,050 points
2,219 views
0 votes
1 answer

Error saying "ValueError: Invalid file object: <_io.BufferedReader name=9>"

Once you've executed the following command, your ...READ MORE

May 28, 2019 in Python by Tamanna
5,931 views
0 votes
1 answer

How I do get the data from the <font> tag from a given tr tag?

This should work: from bs4 import BeautifulSoup html_doc='''<tr id="tr_m_1570:240HJY" ...READ MORE

Sep 18, 2019 in Python by Omkar
• 69,220 points
980 views
0 votes
1 answer

Sort list by frequency in python

You can try the following for a ...READ MORE

May 13, 2019 in Python by SDeb
• 13,300 points
6,466 views
+1 vote
1 answer

I wanted to change the entire row where index is 9 how can i do that

Import the file as a pandas dataframe ...READ MORE

Sep 16, 2019 in Python by Rishi
974 views
0 votes
1 answer

How to read numbers from file in Python?

Assuming you don't have extraneous whitespace: with open('file') ...READ MORE

Apr 16, 2019 in Python by SDeb
• 13,300 points
7,627 views
0 votes
1 answer

Bypassing Cloudflare Scrapeshield

Scrapeshield basically checks if you are using ...READ MORE

Jun 24, 2019 in Python by SDeb
• 13,300 points
4,635 views
+1 vote
0 answers
0 votes
2 answers

How to implement Stack in python

There are different method to implement stack ...READ MORE

Jun 21, 2020 in Python by pagarsach
• 160 points
1,498 views
0 votes
0 answers

Converting a csv file into html file using pandas file.to_html command in pycharm?

Hello guys, I am having some problems ...READ MORE

Aug 24, 2019 in Python by anonymous
2,002 views
+1 vote
2 answers

Remove all whitespace in a string in Python

You can also use regular expressions for ...READ MORE

Aug 31, 2018 in Python by Omkar
• 69,220 points
17,376 views
0 votes
2 answers

Equivalent of a?b:c in Python

result = "F" if(isfemale_bit) else "M" print(result) Try this ...READ MORE

Dec 15, 2019 in Python by Manel
4,380 views
0 votes
1 answer

How to add a new Python interpreter in PyCharm?

Refer to the below screenshots: Then set a ...READ MORE

May 30, 2019 in Python by Shabnam
• 930 points
5,599 views
0 votes
1 answer

How to get score of prediction from random forest?

Well, there's a built-in method for this ...READ MORE

Sep 10, 2019 in Python by Arvind
• 3,050 points
1,190 views
+1 vote
1 answer

Error loading package list:pypi.python.org

You can try doing the following : go ...READ MORE

Jan 9, 2019 in Python by ana1504.k
• 7,910 points
11,639 views
0 votes
1 answer

Get all tags from taggit

You can use all() to get all the tags ...READ MORE

Aug 5, 2019 in Python by SDeb
• 13,300 points
2,665 views
0 votes
1 answer

what is a constructor in python?

Constructors are for instantiating an object.The task ...READ MORE

Apr 1, 2019 in Python by Tushar
• 200 points
8,160 views
0 votes
1 answer

opencv Unable to stop the stream: Inappropriate ioctl for device

I have solved this issue on Ubuntu ...READ MORE

Jul 20, 2019 in Python by SDeb
• 13,300 points
3,376 views
+1 vote
1 answer

how to run list of functions using Thread?

You could import the file with function ...READ MORE

Aug 26, 2019 in Python by Vishaka
1,755 views
0 votes
2 answers

Avoiding multiple nested for-loops in python

Instead of multi-loop, If you can categorize ...READ MORE

Sep 15, 2018 in Python by pedro67657
• 160 points

edited Sep 15, 2018 by Vardhan 16,627 views
+2 votes
0 answers

I am trying to create mininet, but I cannot ping all host and switch

I am trying to do mininet environment ...READ MORE

Aug 4, 2019 in Python by Jiun-Jung
• 140 points
2,592 views
0 votes
1 answer

MiniNAM error "ovs-vsctl: no bridge named s1, ovs-vsctl: no bridge named s2"

You are getting this error because you ...READ MORE

Aug 5, 2019 in Python by Haider
2,587 views
0 votes
1 answer

i had problem with selenium x path i make Facebook sharing script but he is not clicking share button? i'm using python

Hey Hazma, I tried running your code, ...READ MORE

Jul 26, 2019 in Python by Abha
• 28,140 points
3,045 views
0 votes
0 answers

why iam getting this error

Sep 9, 2019 in Python by NEELAPALA
• 120 points

reopened Sep 9, 2019 by Omkar 1,091 views
0 votes
1 answer

How to iterate over row in a Dataframe in Pandas?

Hi, You can use df.iterrows(), it yields both ...READ MORE

Jul 19, 2019 in Python by Taj
• 1,080 points
3,254 views
0 votes
1 answer

Connect to an URI in postgres

The connection string passed to psycopg2.connect is ...READ MORE

Jul 29, 2019 in Python by SDeb
• 13,300 points
2,765 views
0 votes
1 answer

convert a SAS datetime in Pandas

SAS date value is a value that ...READ MORE

Jul 8, 2019 in Python by SDeb
• 13,300 points
3,661 views
0 votes
1 answer

Adding two pandas dataframes

you can try the following: x.add(y, fill_value=0) import pandas ...READ MORE

Feb 12, 2019 in Python by SDeb
• 13,300 points
9,938 views