Most answered questions in Python

0 votes
1 answer

popen.communicate in Python

Your second bit of code starts the ...READ MORE

Nov 13, 2018 in Python by Priyaj
• 58,090 points
2,800 views
0 votes
1 answer

Sort Counter by value? - python

>>> x = Counter({'a':1, 'b':2, 'c':3}) >>> ...READ MORE

Nov 13, 2018 in Python by Priyaj
• 58,090 points
1,299 views
0 votes
1 answer

Applications built using Python

Python is suitable for almost all possible ...READ MORE

Nov 13, 2018 in Python by SDeb
• 13,300 points
335 views
0 votes
1 answer

Difference between module and Package in Python

A module is basically a single file ...READ MORE

Nov 13, 2018 in Python by SDeb
• 13,300 points
2,201 views
0 votes
1 answer

Shortest path from source to and from a negative cycle using Bellman Ford in Python

class NegativeWeightFinder: def __init__(self, graph: nx.Graph): ...READ MORE

Nov 13, 2018 in Python by Nymeria
• 3,560 points
1,116 views
0 votes
1 answer

What's the right way to concatenate files and appending the New Line character in Python? Text or binary mode?

It seems like you're using the wrong ...READ MORE

Nov 13, 2018 in Python by Anirudh
• 2,080 points

edited Dec 14, 2018 by Anirudh 1,286 views
0 votes
1 answer

% operator in Python

When you use '(%g,%g)', it is the ...READ MORE

Nov 12, 2018 in Python by ana1504.k
• 7,910 points
521 views
0 votes
1 answer

Power Math in Python

When you use "^" operator, it is ...READ MORE

Nov 12, 2018 in Python by ana1504.k
• 7,910 points
536 views
0 votes
1 answer

Meaning of -> in Python

It's a function annotation. In more detail, Python 2.x ...READ MORE

Nov 12, 2018 in Python by Priyaj
• 58,090 points
492 views
0 votes
1 answer

Install PIP on Python 3.6

pip is bundled with Python > 3.4 On Unix-like ...READ MORE

Nov 12, 2018 in Python by Priyaj
• 58,090 points
996 views
0 votes
1 answer

Python and Anaconda

Read this article and you will get ...READ MORE

Nov 12, 2018 in Python by Priyaj
• 58,090 points
538 views
0 votes
1 answer

Know/change current directory in Python shell?

This will work  >>> import os >>> os.getcwd() '/home/user' >>> os.chdir("/tmp/") >>> ...READ MORE

Nov 12, 2018 in Python by Priyaj
• 58,090 points
1,544 views
0 votes
1 answer

What is logits, softmax and softmax_cross_entropy_with_logits in Python?

Suppose you have two tensors, where y_hat contains computed ...READ MORE

Nov 12, 2018 in Python by Nymeria
• 3,560 points
4,227 views
0 votes
1 answer

How to convert a Pandas GroupBy object to DataFrame in Python

g1 here is a DataFrame. It has a hierarchical index, ...READ MORE

Nov 12, 2018 in Python by Nymeria
• 3,560 points
34,136 views
0 votes
1 answer

What is GIL in CPython?

Python's GIL is intended to serialize access ...READ MORE

Nov 9, 2018 in Python by SDeb
• 13,300 points
664 views
0 votes
1 answer

Is there a stack/heap in Python?

Memory management in Python involves a private ...READ MORE

Nov 9, 2018 in Python by SDeb
• 13,300 points
1,526 views
0 votes
1 answer

In NumPy how do I get the maximum of subsets? Python

You can use np.maximum.reduceat: >>> _, idx = np.unique(g, ...READ MORE

Nov 9, 2018 in Python by Nymeria
• 3,560 points
1,338 views
0 votes
1 answer

Pycharm warning: Must implement all abstract methods in Python. Why?

n vote As expected, python itself recognises that ...READ MORE

Nov 9, 2018 in Python by Nymeria
• 3,560 points
3,656 views
0 votes
1 answer

Search help using Python Console

The pydoc -k flag searches the documentation. pydoc ...READ MORE

Nov 8, 2018 in Python by SDeb
• 13,300 points
461 views
0 votes
1 answer

Increment with ++ in Python

Python doesn't support ++, so we use: number ...READ MORE

Nov 8, 2018 in Python by SDeb
• 13,300 points
3,759 views
0 votes
1 answer

Lazy loading of columns in sqlalchemy python

class Book(Base): __tablename__ = ...READ MORE

Nov 8, 2018 in Python by Nymeria
• 3,560 points
589 views
0 votes
1 answer

Python socket.sendall() function working

socket_sendall clearly gives up once send() returns -1, ...READ MORE

Nov 8, 2018 in Python by Nymeria
• 3,560 points
1,862 views
0 votes
1 answer

How to activate virtualenv in Python? Help!

One major issue I see is that ...READ MORE

Nov 5, 2018 in Python by Nymeria
• 3,560 points

edited Dec 17, 2018 by Nymeria 4,298 views
0 votes
1 answer

Why is Python scoping made the way it is?

The likeliest answer is that it just ...READ MORE

Nov 5, 2018 in Python by Nymeria
• 3,560 points

edited Dec 17, 2018 by Nymeria 410 views
0 votes
1 answer

Real-world examples of applications in python?

You can view this reference here: Python projects ...READ MORE

Nov 2, 2018 in Python by Nabarupa
1,453 views
0 votes
1 answer

How to implement Queue in python

You are missing this  from queue import * This ...READ MORE

Nov 2, 2018 in Python by Nabarupa
2,610 views
0 votes
1 answer

How to sort dictionary by value python

This would work: d = sorted(data, key = ...READ MORE

Nov 2, 2018 in Python by Nabarupa
540 views
0 votes
1 answer

boolean in Python

True ... and False obviously. checker = None # not necessary if ...READ MORE

Nov 2, 2018 in Python by Priyaj
• 58,090 points
476 views
0 votes
1 answer

Using filter, map, and reduce in Python

A quick implementation might look like this: from ...READ MORE

Nov 2, 2018 in Python by Priyaj
• 58,090 points
882 views
0 votes
1 answer

What are namespaces in Python?

Namespace is basically a way to implement ...READ MORE

Oct 31, 2018 in Python by SDeb
• 13,300 points
537 views
0 votes
1 answer

Meta classes in Python

A Metaclass is the class of a ...READ MORE

Oct 31, 2018 in Python by SDeb
• 13,300 points
397 views
0 votes
1 answer

How do I generate some random numbers with a distribution using Python?

scipy.stats.rv_discrete is what you ned IMHO. You can supply ...READ MORE

Oct 31, 2018 in Python by Anirudh
• 2,080 points

edited Dec 14, 2018 by Anirudh 1,181 views
0 votes
1 answer

kwargs in Python

kwargs in **kwargs is just variable name. You can very ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 58,090 points
405 views
0 votes
1 answer

Open multiple files using with open() in Python?

Just replace and with , and you're done: with open('a', 'w') as ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 58,090 points
8,361 views
0 votes
1 answer

Run python script on terminal (ubuntu)?

Your shell in the terminal has a concept ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 58,090 points
4,618 views
0 votes
1 answer

How does slice notation in Python work?

The Python tutorial talks about it (scroll down a ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 58,090 points
572 views
0 votes
1 answer

How to convert datetime.date to UTC timestamp in Python

In Python 3 (< 3.3) From the docs ...READ MORE

Oct 31, 2018 in Python by Priyaj
• 58,090 points
9,646 views
0 votes
1 answer

Best library for reading meta-data

You can use PowerShell to implement ID3 ...READ MORE

Oct 31, 2018 in Python by nirvana
• 3,130 points
1,113 views
0 votes
1 answer

When to use file vs open in Python?

File() has been removed since Python 3.0 ...READ MORE

Oct 30, 2018 in Python by SDeb
• 13,300 points
1,085 views
0 votes
1 answer

How are Python and Anaconda Related?

Anaconda is a free and open-source Python ...READ MORE

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

Python: Print variable and string in same line

For a better understanding you can refer ...READ MORE

Oct 30, 2018 in Python by Priyaj
• 58,090 points
1,306 views
+1 vote
1 answer

Implement Quicksort in Python

This will help you. def sort(array=[2,5,1,6,9,8,7,10,21,12]): ...READ MORE

Oct 30, 2018 in Python by Priyaj
• 58,090 points
865 views
+1 vote
1 answer

How is raw_input() and input() in python3.x?

raw_input() was renamed to input() so now input() returns the exact string ...READ MORE

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

What is the fucntion of mkdir -p in Python

mkdir -p gives you an error if the ...READ MORE

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

Difference between iterators & generators

iterator is a more general concept: any ...READ MORE

Oct 29, 2018 in Python by SDeb
• 13,300 points
2,823 views
0 votes
1 answer

Speech Recognition and Python

you can use https://pypi.python.org/pypi/pygsr $> pip install pygsr example ...READ MORE

Oct 29, 2018 in Python by SDeb
• 13,300 points
789 views
0 votes
1 answer

Install Python packages on Windows?

First, pip is preferred over easy_install.  Then follow these steps to ...READ MORE

Oct 29, 2018 in Python by Priyaj
• 58,090 points
827 views
0 votes
1 answer

Tips for debugging Python program?

Follow the documentation pn PDB here :-  PDB You ...READ MORE

Oct 29, 2018 in Python by Priyaj
• 58,090 points
444 views
0 votes
1 answer

Declare variable without assigning any value in Python?

var = None Python is dynamic, so you ...READ MORE

Oct 29, 2018 in Python by Priyaj
• 58,090 points
3,477 views
0 votes
1 answer

Multiprocessing queue in Python?

Here you can find a brief example ...READ MORE

Oct 29, 2018 in Python by Priyaj
• 58,090 points
2,679 views