Tag: r

60 votes
4 answers
2.2K views
How can I add jars to the classpath when I invoke Jython *without* adding them to $CLASSPATH?

I'd like to do something similar to jython -cp FOO:BAR:BAZ argle.py. If I add FOO, BAR, and BAZ to $CLAS

avatar
Majorie
0 1 0 9
asked 07 September, 2021
62 votes
9 answers
797 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
57 votes
23 answers
2.8K views
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
642 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
599 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
53 votes
5 answers
2.6K views
What is the difference between ndarray and array in numpy?

What is the difference between ndarray and array in Numpy? And where can I find the implementations in the num

avatar
Majorie
0 1 0 9
asked 07 September, 2021
58 votes
6 answers
1.9K views
Concatenating two one-dimensional NumPy arrays

I have two simple one-dimensional arrays in NumPy. I should be able to concatenate them using numpy.concatenat

avatar
Hilario
0 1 0 9
asked 07 September, 2021
47 votes
17 answers
2.5K views
How do I check which version of NumPy I'm using?

How can I check which version of NumPy I'm using? (FYI this question has been edited because both the qu

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
50 votes
7 answers
1.3K views
Comparing two NumPy arrays for equality, element-wise

What is the simplest way to compare two NumPy arrays for equality (where equality is defined as: A = B iff for

avatar
Hildegard
0 1 0 9
asked 07 September, 2021
62 votes
23 answers
2.8K views
What does axis in pandas mean?

Here is my code to generate a dataframe: import pandas as pd import numpy as np dff = pd.DataFrame(np.random

avatar
Kurtis
0 1 0 9
asked 07 September, 2021
62 votes
8 answers
1.2K views
How to convert a PIL Image into a numpy array?

Alright, I'm toying around with converting a PIL image object back and forth to a numpy array so I can do

avatar
Basil
0 1 0 9
asked 07 September, 2021
54 votes
3 answers
2.6K views
What is the difference between flatten and ravel functions in numpy?

import numpy as np y = np.array(((1,2,3),(4,5,6),(7,8,9))) OUTPUT: print(y.flatten()) [1 2 3 4 5 6

avatar
Arline
0 1 0 9
asked 07 September, 2021
65 votes
6 answers
1.5K views
What is the difference between Numpy's array() and asarray() functions?

What is the difference between Numpy's array() and asarray() functions? When should you use one rather th

avatar
Louetta
0 1 0 9
asked 07 September, 2021
55 votes
15 answers
786 views
How do I create an empty array/matrix in NumPy?

I can't figure out how to use an array or matrix in the way that I would normally use a list. I want to c

avatar
Jefferey
0 1 0 9
asked 07 September, 2021
54 votes
7 answers
1.3K views
Difference between numpy.array shape (R, 1) and (R,)

In numpy, some of the operations return in shape (R, 1) but some return (R,). This will make matrix multiplica

avatar
Solomon
0 1 0 9
asked 07 September, 2021