Most viewed questions in Python

0 votes
1 answer

IPC between Python and C#

You can use a simple socket communication, ...READ MORE

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

How to combine two columns of text in pandas dataframe?

If both columns are strings, you can ...READ MORE

Jan 5, 2021 in Python by Gitika
• 65,910 points
1,709 views
0 votes
1 answer

Reformat value_counts() analysis in Pandas for large number of columns

I'd do it this way: In [83]: df.drop('id',1).apply(lambda ...READ MORE

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

Reading a CSV file using Python 3

A simple "if" statement should suffice. you ...READ MORE

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

Implementing a SAML client in Python

I know you are looking for a ...READ MORE

Apr 29, 2019 in Python by SDeb
• 13,300 points
1,699 views
0 votes
1 answer

Why are Lists faster than character arrays for string concatenation?

It's true that in the list-append method, ...READ MORE

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

I want to insert an element at a specific index in a list and return the updated list.

Hi, Using insert() method you can insert the ...READ MORE

Jun 7, 2019 in Python by Taj
• 1,080 points
1,695 views
–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

Mar 29, 2019 in Python by rajesh
• 1,270 points
1,695 views
0 votes
1 answer

How to enable python3 in vim?

You didn't tell us the platform you're ...READ MORE

Jan 21, 2019 in Python by SDeb
• 13,300 points
1,694 views
0 votes
1 answer

How to read a HDF file with Pandas?

Hi@akhtar, You can read an HDF file using ...READ MORE

Oct 18, 2020 in Python by MD
• 95,440 points
1,693 views
0 votes
1 answer

How do I use lambda() with reduce() in python?

The reduce() function in Python takes in ...READ MORE

May 20, 2019 in Python by Umer
1,692 views
0 votes
1 answer

How to keep keys/values in same order as declared?

Hello @kartik, Dictionaries will use an order that ...READ MORE

Apr 30, 2020 in Python by Niroj
• 82,880 points
1,691 views
0 votes
1 answer

How to do Matrix Multiplication in python?

def matmult(a,b): zip_b = ...READ MORE

Nov 15, 2018 in Python by findingbugs
• 3,260 points
1,689 views
0 votes
1 answer

Could you please help to write a code for this program

Hello, @Hitesh, You can follow the below: print("List of ...READ MORE

Nov 4, 2020 in Python by Roshni
• 10,520 points
1,684 views
0 votes
1 answer

Example of creating horizontal bar chart using matplotlib

Try this: import matplotlib.pyplot as plt import numpy as ...READ MORE

May 27, 2019 in Python by Vaishnavi
1,683 views
0 votes
1 answer

Circular buffer in Python

You can use collections.deque with a maxlen ...READ MORE

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

What exactly is invalid syntax error?

please solve this error   def TakeImages():     Id=(text.get())   ...READ MORE

Jul 20, 2020 in Python by Prince kumar
1,677 views
+1 vote
1 answer

Python: How to convert text to csv rows separated by a record separator?

Hi @Sumanth, try something like this: import csv with ...READ MORE

Dec 17, 2019 in Python by Pri
1,674 views
0 votes
1 answer

Execute entire DAG using Airflow UI

In Airflow 1.8 and higher there is ...READ MORE

May 21, 2019 in Python by SDeb
• 13,300 points
1,670 views
+3 votes
5 answers

is python compatible with Linux?

Just follow these three commands and you ...READ MORE

Sep 12, 2018 in Python by charlie_brown
• 7,720 points
1,670 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
1,667 views
0 votes
1 answer

Getting friendly device names in python

Regarding Linux, if all you need is ...READ MORE

Mar 26, 2019 in Python by SDeb
• 13,300 points
1,667 views
0 votes
0 answers

Cannot make connection to .accdb file using python

I am writing a script that needs ...READ MORE

Jun 7, 2018 in Python by aryya
• 7,450 points
1,663 views
0 votes
1 answer

How to parse html file to BeautifulSoup?

Hey. Refer to the following code: driver.get("link") html = ...READ MORE

Apr 2, 2019 in Python by Kirti
1,657 views
0 votes
0 answers

can't compare offset-naive and offset-aware datetimes

While I'm Trying to Compare Two dates ...READ MORE

Dec 12, 2020 in Python by Mohamed
• 170 points
1,655 views
0 votes
2 answers

Python UnboundLocalError error while executing script

Inside your function when you say word=word+1, ...READ MORE

May 22, 2020 in Python by Ibrahim Nezar
• 140 points
1,655 views
0 votes
1 answer

How to unzip a list of tuples into individual lists?

Hello @kartik, zip is its own inverse! Provided you ...READ MORE

Apr 23, 2020 in Python by Niroj
• 82,880 points
1,647 views
0 votes
1 answer

How to strip html/javascript from text input in django?

Hello @kartik, Django provides an utility function to ...READ MORE

Aug 17, 2020 in Python by Niroj
• 82,880 points
1,646 views
+1 vote
5 answers

Check whether the file exists or not?

Use this import os os.path.exists(path) # Returns whether the ...READ MORE

Oct 18, 2018 in Python by reyam
1,643 views
0 votes
1 answer

How do I sync the two models to two databases?

Hello @kartik, To sync the two models to ...READ MORE

Jun 29, 2020 in Python by Niroj
• 82,880 points
1,641 views
+1 vote
1 answer

Pressing "ENTER" in Instagram search box Python Selenium

driver.get("https://www.instagram.com/explore/tags/" + hashtag + "/") You will not ...READ MORE

Nov 5, 2020 in Python by vinnie Irvine

reshown Nov 5, 2020 by Sirajul 1,641 views
+7 votes
2 answers

I want to build a recommender system incorporating diversity and accuracy in the recommender engine.

I dont know what exactly you are ...READ MORE

Sep 24, 2018 in Python by slayer
• 29,350 points
1,641 views
0 votes
1 answer

How to configure smtp server using python?

Hi@akhtar, To set smtp server in your system, ...READ MORE

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

Python class inherits an object

Python 3.x: class MyClass(object): = new-style class class MyClass: ...READ MORE

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

How to dynamically load a module in Python?

Hi, Dynamic loading is where we do not ...READ MORE

Jun 26, 2020 in Python by Roshni
• 10,520 points
1,638 views
0 votes
1 answer

how to download and install Django rest framework?

To install Django, you can simply open ...READ MORE

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

How to check whether something is a variable or a function in Python?

Suppose you have a variable defined in ...READ MORE

Jul 30, 2019 in Python by Arvind
• 3,040 points
1,636 views
0 votes
1 answer

High Precision value and low recall value - Logistic regression

You use high positive and low recall ...READ MORE

Jun 13, 2019 in Python by Greg
1,632 views
0 votes
2 answers

How do I connect to a MySQL Database in Python?

connect mysql database with python import MySQLdb db = ...READ MORE

Mar 28, 2019 in Python by rajesh
• 1,270 points
1,630 views
0 votes
1 answer

'pip' is not recognized as an internal or external command, operable program or batch file.

You will have to add the path ...READ MORE

Feb 8, 2022 in Python by Soham
• 9,700 points
1,627 views
0 votes
0 answers

How to calculate accuracy in a logistic regression model in python?

What accuracy score is considered a good ...READ MORE

Jul 30, 2019 in Python by Waseem
• 4,540 points
1,627 views
0 votes
1 answer

Sum a list of numbers in Python

Let us take a list of Numbers ...READ MORE

Feb 14, 2022 in Python by Nandini
• 5,480 points
1,622 views
0 votes
1 answer

TypeError: a bytes-like object is required, not 'str' when writing to a file in Python3

After what I observed, you would have ...READ MORE

Feb 11, 2022 in Python by Rahul
• 9,670 points
1,622 views
0 votes
0 answers

Truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()

 I am getting this error: Truth value of ...READ MORE

May 9, 2022 in Python by Kichu
• 19,050 points
1,620 views
0 votes
0 answers

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

I'm trying to plot the exponential and ...READ MORE

Jul 9, 2019 in Python by JTM
1,601 views
0 votes
1 answer

NaN variable without NumPy

Yes, It is possible to use the ...READ MORE

Nov 26, 2018 in Python by SDeb
• 13,300 points
1,601 views
0 votes
1 answer

urllib2 and json

I think you need to specify a ...READ MORE

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

PEP8 space after a comma

I guess the reason that most people ...READ MORE

Jul 20, 2019 in Python by SDeb
• 13,300 points
1,598 views
0 votes
1 answer

How to perform web scraping with python?

Hey, there are various libraries used in ...READ MORE

Apr 20, 2018 in Python by aayushi
• 750 points
1,598 views
0 votes
1 answer

How to save an image locally using Python in which we already know the URL address?

Hi, @Roshni, The following code is used to ...READ MORE

Jun 26, 2020 in Python by Gitika
• 65,910 points
1,596 views