Most viewed questions in Python

0 votes
1 answer

How to write content of one file to another file in Python?

The following code snippet might solve your ...READ MORE

Aug 26, 2019 in Python by Neel
• 3,020 points
631 views
–1 vote
1 answer

How to calculate difference in timestamp columns?

First, write the data in a csv file. Then ...READ MORE

Jan 19, 2019 in Python by Omkar
• 69,230 points
631 views
0 votes
1 answer

How to check the version of Python?

you can check the version of python ...READ MORE

Sep 25, 2018 in Python by SDeb
• 13,300 points
631 views
0 votes
1 answer

syntaxerror: "unexpected character after line continuation character in python" math

There is a slight confusion as both ...READ MORE

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

Python division

You're using Python 2.x, where integer divisions ...READ MORE

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

Understanding Pickling in Python

While others have pointed to the Python ...READ MORE

Aug 22, 2018 in Python by Priyaj
• 58,090 points
629 views
0 votes
1 answer

What exactly are iterator, iterable, and iteration?

Iteration is a process in which one ...READ MORE

Feb 11, 2022 in Python by Dev
• 6,000 points
627 views
0 votes
1 answer

Open database connection - python

Hey you can use something like this: import ...READ MORE

Jul 23, 2019 in Python by Kyraa
626 views
0 votes
0 answers

How to remove elements from a list that may or may not be present?

In case I want to remove some ...READ MORE

Jun 27, 2019 in Python by Nisa
• 1,090 points
626 views
0 votes
1 answer

How to concatenate Pandas dataframes?

Suppose you have 3 dataframes named df1, ...READ MORE

May 14, 2019 in Python by Rasheed
626 views
+1 vote
1 answer

Run tally of events within a given period using datetime

If you have access to pandas, pd.Series.cumcount is one way. ...READ MORE

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

Can we download python from command line?

Open a command prompt window and navigate to the ...READ MORE

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

Is it possible to print a string and a variable in a single print statement in Python?

This can be done using simple string ...READ MORE

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

Consistent versioning in Python project

This is one of the most asked ...READ MORE

May 22, 2019 in Python by SDeb
• 13,300 points
625 views
0 votes
1 answer

How do I migrate a model out of one django app and into a new one?

Hello @kartik, Try this: from south.db import db from south.v2 ...READ MORE

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

how can i import the tensorflow library in python?

to import the tensorflow library in your ...READ MORE

May 21, 2019 in Python by Mohammad
• 3,230 points
624 views
0 votes
1 answer

Remove duplicate elements in a list

Here is the code for this - list(set((list_of_numbers) For ...READ MORE

May 12, 2018 in Python by Hamartia's Mask
• 1,580 points
624 views
0 votes
1 answer

I can't get a graph out of my information

Hi@lzzy, According to your error, there is a ...READ MORE

Jun 11, 2020 in Python by MD
• 95,440 points
623 views
0 votes
1 answer

How to clone or copy a list?

Hello @kartik, With new_list = my_list, you don't actually ...READ MORE

May 15, 2020 in Python by Niroj
• 82,880 points
623 views
0 votes
0 answers

inv_ypred mean in python

Mar 7, 2019 in Python by anonymous

recategorized Mar 7, 2019 by Vardhan 623 views
0 votes
1 answer

Need help with Django URL string parameter pattern in Python

Good question. The solution to this short ...READ MORE

Jan 28, 2019 in Python by Nymeria
• 3,560 points
623 views
0 votes
1 answer

What is the difference between an interface and abstract class?

Interfaces An interface is a contract: The person writing ...READ MORE

Nov 30, 2020 in Python by Gitika
• 65,910 points
622 views
0 votes
1 answer

How does garbage collection happen in Python?

The Garbage collection runs automatically as the ...READ MORE

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

Extract all characters of a string

Convert it to a list -  s = ...READ MORE

Jun 1, 2018 in Python by Nietzsche's daemon
• 4,260 points
622 views
0 votes
1 answer

Comparing strings in Python

Convert both the strings to either uppercase ...READ MORE

May 28, 2018 in Python by Nietzsche's daemon
• 4,260 points
622 views
0 votes
1 answer

How to check Django version

The Django 1.5 supports the Python 2.6.5 ...READ MORE

Feb 22, 2022 in Python by Aditya
• 7,680 points
621 views
0 votes
1 answer

How to find the type of variable in Python?

i=277 type(i) # int i = 2.56j type(i) # complex i ...READ MORE

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

how to use urllib module in python?

If you are using Python 3.x then ...READ MORE

Jun 28, 2019 in Python by Neel
• 3,020 points
621 views
0 votes
1 answer

Is there a label/goto in Python?

No, Python does not support labels and ...READ MORE

Aug 1, 2018 in Python by Priyaj
• 58,090 points
621 views
0 votes
1 answer

comparing strings in Python using "==" or "is" [closed]

is is used for identity testing and ...READ MORE

Sep 19, 2018 in Python by SDeb
• 13,300 points
620 views
0 votes
1 answer

How do I parse XML in Python?

First build an Element instance root from the XML, ...READ MORE

Nov 20, 2020 in Python by Gitika
• 65,910 points
619 views
0 votes
1 answer

How do I set a Gtk.StatusIcon as Text?

I don't think that is possible. The ...READ MORE

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

How do I change the working directory in Python?

Hello @kartik, use os.chdir like this: os.chdir("/path/to/change/to") By the way, if you ...READ MORE

Dec 8, 2020 in Python by Niroj
• 82,880 points
618 views
0 votes
0 answers

Can I get chatbot code?

Feb 5, 2020 in Python by Mahesh
• 120 points

edited Feb 5, 2020 by Gitika 618 views
0 votes
1 answer

How can I make a variable private in python?

Python does not have any private variables like C++ or ...READ MORE

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

Which will good platform to perform anaconda navigation or other and install the package on anaconda ide

Hey, @Daulat, We use Anaconda Navigator to launch ...READ MORE

Apr 8, 2020 in Python by Gitika
• 65,910 points
617 views
0 votes
0 answers

What is the syntax for an empty while loop in python?

What kind of ambiguities are expected for ...READ MORE

Aug 5, 2019 in Python by Waseem
• 4,540 points
617 views
0 votes
1 answer

What is the output of and explanation?

It will print concatenated lists. Output would ...READ MORE

Jul 20, 2018 in Python by Priyaj
• 58,090 points
616 views
0 votes
0 answers

How to handle notifications in Python with selenium windows Chrome Webdriver

Good day, I am kid trying to ...READ MORE

Sep 11, 2020 in Python by Kgohlopo
• 120 points
615 views
+1 vote
1 answer

Can assignment operator be used to copy elements in Python?

Yes assignment operator can be used to ...READ MORE

Jul 29, 2019 in Python by Neel
• 3,020 points

edited Jul 30, 2019 by Neel 615 views
0 votes
0 answers

How can I use pi in python?

What is the module required to import ...READ MORE

Jun 11, 2019 in Python by Waseem
• 4,540 points
615 views
0 votes
1 answer

How can I find script's directory with Python?

Hii, You need to call os.path.realpath on __file__, so that when __file__ is ...READ MORE

May 11, 2020 in Python by Niroj
• 82,880 points
614 views
0 votes
1 answer

Snake head placed on the center - Python using turtle

You can use turtle's goto() function. This ...READ MORE

Jun 21, 2019 in Python by Greg
614 views
0 votes
1 answer

What to do when len() does not return the number of integers in range(1,100)?

You can use the following code block: x=range(1,100) len(x) Output: ...READ MORE

May 28, 2019 in Python by Fata
• 1,050 points
614 views
0 votes
0 answers

How can I prevent the TypeError: list indices must be integers, not tuple when copying a python list to a numpy array?

I want to create 3 numpy arrays/lists ...READ MORE

May 7, 2022 in Python by narikkadan
• 63,700 points
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
612 views
0 votes
1 answer

DataFrame slicing in Python

You can use criteria based subset for ...READ MORE

Jul 15, 2019 in Python by Sakra
612 views
0 votes
2 answers

Get key by value in dictionary

I have slightly modified your program to ...READ MORE

Nov 25, 2021 in Python by Python Coder
612 views
0 votes
1 answer

How Lambda() is used with filter() in python?

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

May 20, 2019 in Python by Rakshi
612 views
+5 votes
1 answer

What are metaclasses in Python?

A metaclass instantiates and defines behavior for ...READ MORE

Sep 11, 2018 in Python by Priyaj
• 58,090 points
612 views