Most voted questions in Python

0 votes
1 answer

Purpose of fit method in sklearn module in python?

it basically trains your model using the ...READ MORE

May 14, 2020 in Python by Mahesh
• 140 points
3,172 views
0 votes
1 answer

Which is a good python ide for android devices?

I will suggest you to go for ...READ MORE

Jul 5, 2019 in Python by Neel
• 3,020 points
2,680 views
0 votes
1 answer

How to install and use myql connector in Python?

You can use pip to search if ...READ MORE

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

What does the inplace function does in drop() and dropna() functions?

When inplace=True is passed, the data is renamed in ...READ MORE

Jul 5, 2019 in Python by Wasim
1,773 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,358 views
0 votes
3 answers

Pandas - FillNa with another column

You could do df.Cat1 = np.where(df.Cat1.isnull(), df.Cat2, df.Cat1 ...READ MORE

Dec 15, 2020 in Python by Roshni
• 10,520 points
84,160 views
0 votes
1 answer

Selecting Pandas Columns by dtype

You can use the following: df.loc[:, df.dtypes == ...READ MORE

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

Python error "AttributeError: '_Screen' object has no attribute 'onkeypress'"

Instead of  wn.onkeypress(go_up, "w") Try wn.onkey(go_uo, " ...READ MORE

Jul 5, 2019 in Python by Pooja
4,448 views
0 votes
1 answer

How do I make a delay in Python?

Hahah! Yes, you need to create a ...READ MORE

Jul 4, 2019 in Python by Pooja
1,038 views
0 votes
1 answer

How to install PyInstaller?

Hey @Vedant, yes its easier to install ...READ MORE

Jul 4, 2019 in Python by Pooja
1,713 views
0 votes
1 answer

Python application from .py to .exe

You can use pyinstaller for this purpose. PyInstaller bundles ...READ MORE

Jul 4, 2019 in Python by Pooja
434 views
0 votes
1 answer

Python error "AttributeError: 'str' object has no attribute 'casefold'"

Check your python version. Casefold is possible ...READ MORE

Jul 4, 2019 in Python by Yesha
5,812 views
0 votes
1 answer

Is there a list of timezones in python?

import pytz list(pytz.common_timezones) READ MORE

Aug 2, 2019 in Python by Mohammad
• 3,230 points
936 views
0 votes
0 answers

What is the use of cursor while querying a sqlite database?

I am completely new to sqlite, and ...READ MORE

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

Round columns in pandas dataframe

You can now, use round on dataframe The code will ...READ MORE

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

pandas and Stata 13 files

You can check with the following: Update your ...READ MORE

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

How to access the elements of a dictionary using index ?

Suppose you have a dictionary num = ...READ MORE

Jul 4, 2019 in Python by Arvind
• 3,040 points
2,024 views
0 votes
1 answer

How to create a train and test sample from one dataframe using pandas?

Hi, The below written code can help you ...READ MORE

Jul 4, 2019 in Python by Taj
• 1,080 points
5,521 views
0 votes
1 answer

How do I loop backward using indices in Python?

Hi, You can make use of negative indices ...READ MORE

Jul 4, 2019 in Python by Taj
• 1,080 points
412 views
0 votes
1 answer

Can't use read() for html2text?

decode() the content with the charset sent inside ...READ MORE

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

Populate QComboBox with a list

It looks like you're using the old ...READ MORE

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

What is the purpose of hash function in python?

The hash() method returns the hash value of an object if it ...READ MORE

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

Why is Seaborn better than Mtaplotlib?

Factually, Matplotlib is good but Seaborn is ...READ MORE

Jul 3, 2019 in Python by Wajiha
• 1,950 points
371 views
0 votes
1 answer

How to check if a given string matches a particular pattern in Python?

You can use re module of python ...READ MORE

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

What does AF_INET mean?

AF_INET refers to Address from the Internet ...READ MORE

Jul 3, 2019 in Python by Wajiha
• 1,950 points
3,958 views
0 votes
1 answer

Is it possible to print all the modules imported in a python script?

Since I am using Python 3.6, I ...READ MORE

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

How to change tuple's existing elements?

Hi Priyankar, I understand your problem, but Tuple is immutable - ...READ MORE

Jul 2, 2019 in Python by sampriti
• 1,120 points
2,552 views
0 votes
4 answers

Is it possible to call one python script from another Python Script?

Try using os.system: os.system("script2.py 1") execfile is different because it is ...READ MORE

Dec 16, 2020 in Python by Gitika
• 65,910 points
68,676 views
0 votes
1 answer

How to find exponent of a number in Python?

Yes you can do it using the ...READ MORE

Jul 2, 2019 in Python by Arvind
• 3,040 points
2,071 views
0 votes
2 answers

How do you convert a dictionary to a defaultdict?

from collections import defaultdict a = {1: 2, ...READ MORE

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

How do i install numpy on windows?

Python Package Index (PyPI) is a repository ...READ MORE

Jul 3, 2019 in Python by anonymous
502 views
0 votes
1 answer

Why do variables have bigger scopes in Python than in C?

Only functions, modules, and the bodies of ...READ MORE

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

Slicing a list using a variable, in Python

Yes its possible. Use the following piece ...READ MORE

Jul 2, 2019 in Python by Wajiha
• 1,950 points
1,718 views
0 votes
1 answer

What does the operator "/=" do in python?

x = 20 res = x /= 5 print(res) The ...READ MORE

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

What are raw string literals?

A raw string literal opens with a sequence of ...READ MORE

Jul 31, 2019 in Python by Mohammad
• 3,230 points
645 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
598 views
0 votes
1 answer

How to read a large file, line by line, in Python?

The correct, fully Pythonic way to read ...READ MORE

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

How to check if a csv file is empty in pandas?

Try this: df = pd.DataFrame(columns=['Name', 'ID', 'Department']) if df.empty ...READ MORE

Jul 1, 2019 in Python by Bob
14,073 views
0 votes
1 answer

Python urllib2 Response header

Try to request as Firefox does. You ...READ MORE

Jun 28, 2019 in Python by SDeb
• 13,300 points
2,071 views
0 votes
1 answer

Access the sole element of a set

Use set.pop: >>> {1}.pop() 1 >>> In your case, it would be: return ...READ MORE

Jun 28, 2019 in Python by SDeb
• 13,300 points
500 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
615 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
0 votes
4 answers

how to sort a list of numbers without using built-in functions like min, max or any other function?

Yes it is possible. You can refer ...READ MORE

Jun 27, 2019 in Python by Arvind
• 3,040 points
184,880 views
0 votes
1 answer

how to check the syntax of python program without running the program?

Yes, it is possible to check the ...READ MORE

Jun 27, 2019 in Python by Arvind
• 3,040 points
4,887 views
0 votes
1 answer

How to send information greater than buffer size from server to the client?

complete_info='' while True: msg = ...READ MORE

Jun 27, 2019 in Python by Wajiha
• 1,950 points
2,313 views
0 votes
1 answer

Install .desktop file with setup.py

This looks like a good approach but ...READ MORE

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

How to stop input in SublimeREPL?

You have to do ctrl+break or ctrl+space ...READ MORE

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

How to resolve the error while importing cv2 from openCV in python?

I would recommend you go with anaconda ...READ MORE

Jul 31, 2019 in Python by Mohammad
• 3,230 points
1,705 views
0 votes
3 answers

How to draw a tic tac toe board in python?

def printTable():             for i in range(1,10):                     print(" ",end=' ')                     if(i%3==0 ...READ MORE

Oct 11, 2020 in Python by Sumit Nagpal
11,040 views
0 votes
1 answer

How to add new keys to an already created python dictionary?

my_dict = {'name':'Jack', 'age': 26} my_dict['address'] = 'Downtown' ...READ MORE

Jun 26, 2019 in Python by Neel
• 3,020 points
557 views