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,204 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,694 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,298 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,780 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,380 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,554 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,131 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,472 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,050 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,734 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
457 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,838 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
971 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
341 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,821 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
574 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,052 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,533 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
425 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,474 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,585 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
715 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
379 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
1,015 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
4,017 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,942 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,599 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,863 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,094 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,988 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
515 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
797 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,745 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
697 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
654 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
619 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
622 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,139 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,086 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
522 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
632 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
632 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
185,607 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,957 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,344 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
708 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
704 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,732 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,084 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
575 views