Most answered questions in Python

0 votes
1 answer

How to find cos(60) in radin measure after importing math function

Hi Kushal!  If you have the value of ...READ MORE

Feb 22, 2019 in Python by Omkar
• 69,230 points
1,087 views
+1 vote
1 answer

Not able to Import scikitplot package in my Jupyter Lab

To overcome this issue, you need to ...READ MORE

Feb 21, 2019 in Python by Yami
11,384 views
0 votes
1 answer

Best way to open a socket in Python

Opening sockets in python is pretty simple. ...READ MORE

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

Getting first row from sqlalchemy

Use  query.one() to get one result. In ...READ MORE

Feb 21, 2019 in Python by SDeb
• 13,300 points
5,521 views
0 votes
1 answer

Add string in a certain position

Python Strings are immutable. >>> s='355879ACB6' >>> s[4:4] = ...READ MORE

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

Get object by id()

You'll probably want to consider implementing it ...READ MORE

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

Need help understanding python code

In this particular code, I think you ...READ MORE

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

Is there a Python equivalent to `perl -pi -e`?

The command line usage from 'python -h' ...READ MORE

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

Get business days between start and end date using pandas

You can use BDay() to get the ...READ MORE

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

How to output the rows which are affected using SQLAlchemy in Python?

Hi, good question. This is actually not ...READ MORE

Feb 15, 2019 in Python by Nymeria
• 3,560 points
3,028 views
0 votes
1 answer

How can I prevent brute force login attacks using Django in Python?

Hi. Django-axes is an already existing application ...READ MORE

Feb 15, 2019 in Python by Nymeria
• 3,560 points
2,281 views
0 votes
1 answer

Error installing BeautifulSoup

You can use a simple command to ...READ MORE

Feb 14, 2019 in Python by Omkar
• 69,230 points
4,823 views
0 votes
1 answer

When is the perfect time to use Tornado in python?

There is a server and a webframework. ...READ MORE

Feb 14, 2019 in Python by aryya
• 7,450 points
1,289 views
0 votes
1 answer

How to properly print timezone information using python?

Part of the problem here is that ...READ MORE

Feb 14, 2019 in Python by aryya
• 7,450 points
1,350 views
0 votes
1 answer

What is the equivalent of Django's get_or_create om SQLAlchemy using Python?

As far as I know, there is ...READ MORE

Feb 14, 2019 in Python by Nymeria
• 3,560 points
3,282 views
0 votes
1 answer

K-means or Hierarchical clustering?

You can use hierarchical clustering for this ...READ MORE

Feb 14, 2019 in Python by Dinesh
660 views
0 votes
1 answer

Python script for how much total salary cost has increased

Here you can use groupby() and mean() to get the desired ...READ MORE

Feb 14, 2019 in Python by Umar
1,449 views
0 votes
1 answer

Help fixing the pandas error.

Try this: Uninstall python with admin privileges. Shut down ...READ MORE

Feb 14, 2019 in Python by Saru
8,836 views
0 votes
1 answer

Number of private variables in class

In Python, there is no existence of ...READ MORE

Feb 13, 2019 in Python by Prateek
297 views
0 votes
1 answer

text = _whitespace_only_re.sub('', text) TypeError: expected string or bytes-like object

This seems like an issue with textwrap ...READ MORE

Feb 13, 2019 in Python by Omkar
• 69,230 points
8,720 views
0 votes
1 answer

How to filter HTML tags and resolve entities using Python?

Him the answer is a pretty simple ...READ MORE

Feb 13, 2019 in Python by Nymeria
• 3,560 points
1,908 views
0 votes
1 answer

How can I go about using var == False in Python?

Hi. Simple answer.  All you need to do ...READ MORE

Feb 13, 2019 in Python by Nymeria
• 3,560 points
509 views
0 votes
1 answer

Program to store the details multiple employees

import random class Bank: ...READ MORE

Feb 13, 2019 in Python by Omkar
• 69,230 points
2,060 views
0 votes
1 answer

Can we access Outer class member from an Inner class in Python?

If you want to access outer class ...READ MORE

Feb 13, 2019 in Python by Omkar
• 69,230 points
12,413 views
0 votes
1 answer

How to resolve ImportError: cannot import name 'add' in python ?

There's no module called "add" in random. ...READ MORE

Feb 13, 2019 in Python by Mark
4,389 views
0 votes
1 answer

Sort a part of a list in place

You can write it as such: a[i:j] = ...READ MORE

Feb 12, 2019 in Python by SDeb
• 13,300 points
3,156 views
0 votes
1 answer

Adding two pandas dataframes

you can try the following: x.add(y, fill_value=0) import pandas ...READ MORE

Feb 12, 2019 in Python by SDeb
• 13,300 points
9,379 views
0 votes
1 answer

Inconsistent Whitespace error occurrence when using Python doctest with newline characters

Hi. It's pretty simple actually. All you ...READ MORE

Feb 12, 2019 in Python by Nymeria
• 3,560 points
2,240 views
0 votes
1 answer

How do I check if input string is a valid regular expression or not in Python?

Hi. Good question! Well, just like what ...READ MORE

Feb 12, 2019 in Python by Nymeria
• 3,560 points
10,806 views
0 votes
1 answer

Embed R code in python

You can try this : from rpy import ...READ MORE

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

How to increase plt.title font size?

Try the following : import matplotlib.pyplot as plt plt.figtext(.5,.9,'Temperature', ...READ MORE

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

Need help bootstrapping Python module installation on Amazon EMR

Hello! The easiest way to definitely do this ...READ MORE

Feb 11, 2019 in Python by Nymeria
• 3,560 points
2,362 views
0 votes
1 answer

How to access different Anaconda environments from PyCharm for coding in Python?

Hi! In PyCharm, you can add any number ...READ MORE

Feb 11, 2019 in Python by Nymeria
• 3,560 points
1,221 views
0 votes
1 answer

How to solve indentation in the below code?

Python does not use brackets, it uses ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,230 points
519 views
0 votes
1 answer

Python program to read the excel file which contains more than 65K records

Hi @Rashmi! I read your code and there ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,230 points
1,040 views
0 votes
1 answer

Python convert all sheets of excel to csv

You will have to parse through the ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,230 points
6,999 views
0 votes
1 answer

Python TypeError: 'list' object is not callable.

The error says the list is not ...READ MORE

Feb 9, 2019 in Python by Omkar
• 69,230 points
28,781 views
–1 vote
1 answer

Python convert excel file to csv

Here you go: import glob path_to_excel_files = glob.glob('path/to/excel/files/*.xlsx') for ...READ MORE

Feb 8, 2019 in Python by Omkar
• 69,230 points
976 views
0 votes
1 answer

How to get base class type in Python?

Yes, There is an alternative. You can ...READ MORE

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

Python command line 'file input stream'

You can use argparse to create an ...READ MORE

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

Why are dictionary objects unhashable in Python?

Hi, it is not possible to hash ...READ MORE

Feb 8, 2019 in Python by Nymeria
• 3,560 points
484 views
0 votes
1 answer

How can I make use of getopt or optarg in Python?

Hi, I was asked this by one ...READ MORE

Feb 8, 2019 in Python by Nymeria
• 3,560 points
948 views
0 votes
1 answer

Regarding pyc file in Python

When you run a Python script, Python ...READ MORE

Feb 7, 2019 in Python by Yogi
1,420 views
0 votes
1 answer

Permission denied for .pyc file

Did you run the python script as ...READ MORE

Feb 7, 2019 in Python by Omkar
• 69,230 points
5,059 views
0 votes
1 answer

What is the purpose of inner class in Python?

Advantages of inner class: Logical grouping of classes: ...READ MORE

Feb 7, 2019 in Python by SDeb
• 13,300 points
2,011 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,658 views
0 votes
1 answer

How to zip with a list output in Python instead of a tuple output?

Good question - Considering that you are ...READ MORE

Feb 7, 2019 in Python by Nymeria
• 3,560 points
1,418 views
+1 vote
1 answer

How do I find out the sum of digits of a number in Python?

Hi, good question. If you are considering ...READ MORE

Feb 7, 2019 in Python by Nymeria
• 3,560 points
7,718 views
0 votes
1 answer

Multi-threading program in python

import threading import os def task1(): print("Task 1 assigned ...READ MORE

Feb 7, 2019 in Python by Omkar
• 69,230 points
571 views