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
624 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
624 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
624 views
0 votes
2 answers

How to create new folder?

import os try: os.makedirs(path) except ...READ MORE

Aug 31, 2018 in Python by Omkar
• 69,210 points
623 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
622 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
621 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
621 views
0 votes
1 answer

Flatten 2D list in Python

Here's an example for you: mat = [[10, ...READ MORE

Jun 11, 2019 in Python by Adi
621 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
621 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
621 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
621 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
620 views
0 votes
2 answers

Which programming language should I learn - Python or PHP?

It really depends on what you want ...READ MORE

Jun 11, 2019 in Python by Morten

reshown Jun 11, 2019 by Vardhan 620 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
619 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
619 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
618 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
618 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
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 617 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
616 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
616 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
616 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
616 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
614 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
614 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
614 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
614 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
613 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
612 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
612 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
612 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,620 points
611 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
611 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
611 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
610 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
610 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
610 views
0 votes
1 answer

Convert data in dataframe - Python

Reshape dataframe using DataFrame.unstack for DatetimeIndex, then ...READ MORE

May 30, 2019 in Python by Gargi
609 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
608 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
608 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
607 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
607 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
606 views
0 votes
1 answer

How to get an absolute file path in Python?

Hello @kartik, Try this out: >>> import os >>> os.path.abspath("mydir/myfile.txt") 'C:/example/cwd/mydir/myfile.txt' Also ...READ MORE

Dec 7, 2020 in Python by Niroj
• 82,880 points
605 views
0 votes
0 answers

inv_ypred mean in python

Mar 7, 2019 in Python by anonymous

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

difference between lists and sets

There are a lot more differences such ...READ MORE

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

How can I rename files on the fly using Python?

You could simply use a wrapper object ...READ MORE

Sep 7, 2018 in Python by aryya
• 7,450 points
605 views
0 votes
1 answer

Python class inherits object

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

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

How to rename columns in pandas?

Hi,  To rename columns in pandas, you can ...READ MORE

Aug 9, 2019 in Python by Taj
• 1,080 points
604 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
604 views