Python

Python is a dynamic, strongly typed, object-oriented, multipurpose programming language, designed to be quick (to learn, to use, and to understand), and to enforce a clean and uniform syntax. Two similar but incompatible versions of Python are in use (Python 2.7 or 3.x). For version-specific Python questions, please also use the [python-2.7] or [python-3.x] tags. When using a Python variant (Jython, Pypy, Iron-python, etc.) - please also tag the variant.

57 votes
8 answers
1.4K views
Email an attachment in R with gmail

I am desiring to send an email in R with an attachment using gmail. I have found that sendmailR does not work

avatar
Dario
0 1 0 9
asked 07 September, 2021
56 votes
6 answers
2.5K views
Migrating from CPython to Jython

I'm considering moving my code (around 30K LOC) from CPython to Jython, so that I could have better integ

avatar
Benton
0 1 0 9
asked 07 September, 2021
62 votes
1 answers
1.4K views
Using Jython through IPython: is readline still an issue?

I'd like to use the Jython interpreter with IPython, so that I could use things like tab completion and p

avatar
Solomon
0 1 0 9
asked 07 September, 2021
67 votes
4 answers
1.7K views
How can I make the PyDev editor selectively ignore errors?

I'm using PyDev under Eclipse to write some Jython code. I've got numerous instances where I need t

avatar
Lynette
0 1 0 9
asked 07 September, 2021
55 votes
2 answers
345 views
What is the difference between Python vs Jython vs IronPython vs wxPython?

I am quite new in Python programming. While googling I found some of the Python related words. I just wanted t

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
54 votes
1 answers
442 views
Why is Jython much slower than CPython, despite the JVM's advances?

No flame wars please. I am admittedly no fan of Java, but I consider the JVM to be a fairly decent and well-op

avatar
Denese
0 1 0 9
asked 07 September, 2021
62 votes
9 answers
794 views
Cross-platform way to get PIDs by process name in python

Several processes with the same name are running on host. What is the cross-platform way to get PIDs of those

avatar
Kisha
0 1 0 9
asked 07 September, 2021
52 votes
4 answers
1.4K views
Distributing my Python scripts as JAR files with Jython?

I have been a Python programmer for almost two years, and I am used to writing small scripts to automate some

avatar
Sachiko
0 1 0 9
asked 07 September, 2021
50 votes
7 answers
1.5K views
Programming Android apps in jython

The other day I came across a Python implementation called Jython. With Jython you can write Java applications

avatar
Joseph
0 1 0 9
asked 07 September, 2021
60 votes
4 answers
2.1K views
When will Jython support Python 3?

According to Jython's documentation: Jython is an implementation of the Python language for the Jav

avatar
Lawanda
0 1 0 9
asked 07 September, 2021
60 votes
7 answers
1.9K views
Boolean identity == True vs is True

It is standard convention to use if foo is None rather than if foo == None to test if a value is specifically

avatar
Cortez
0 1 0 9
asked 07 September, 2021
57 votes
23 answers
2.8K views
52 votes
7 answers
1.1K views
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I just discovered a logical bug in my code which was causing all sorts of problems. I was inadvertently doing

avatar
Dwain
0 1 0 9
asked 07 September, 2021
52 votes
8 answers
1K views
dropping infinite values from dataframes in pandas?

what is the quickest/simplest way to drop nan and inf/-inf values from a pandas DataFrame without resetting mo

avatar
Scot
0 1 0 9
asked 07 September, 2021
56 votes
7 answers
1.9K views
NumPy array initialization (fill with identical values)

I need to create a NumPy array of length n, each element of which is v. Is there anything better than: a = e

avatar
Chaya
0 1 0 9
asked 07 September, 2021
62 votes
16 answers
1.9K views
Better way to shuffle two numpy arrays in unison

I have two numpy arrays of different shapes, but with the same length (leading dimension). I want to shuffle e

avatar
Wilfredo
0 1 0 9
asked 07 September, 2021
55 votes
16 answers
1.5K views
numpy: most efficient frequency counts for unique values in an array

In numpy / scipy, is there an efficient way to get frequency counts for unique values in an array? Something

avatar
Xavier
0 1 0 9
asked 07 September, 2021
53 votes
10 answers
638 views
How to take column-slices of dataframe in pandas

I load some machine learning data from a CSV file. The first 2 columns are observations and the remaining colu

avatar
Basil
0 1 0 9
asked 07 September, 2021
57 votes
10 answers
595 views
How do I convert a numpy array to (and display) an image?

I have created an array thusly: import numpy as np data = np.zeros( (512,512,3), dtype=np.uint8) data[256,256

avatar
Tana
0 1 0 9
asked 07 September, 2021
57 votes
13 answers
1.8K views
Converting numpy dtypes to native python types

If I have a numpy dtype, how do I automatically convert it to its closest python data type? For example, num

avatar
Lashawna
0 1 0 9
asked 07 September, 2021