God damn!

God damn!
Working with numpy arrays is such a pain in the ass!
Why can't they address arrays like normal people?
I'm having problems even with basic stuff like removing all colums where the value are the same and equal to some number. grrr!

Perl Data Language

> Working with numpy arrays is such a pain in the ass!
You could always use Scala + Spark or Breeze on Jupyter.

> I'm having problems even with basic stuff like removing all colums where the value are the same and equal to some number. grrr!
Eh, why is that a problem? Sounds like introductory homework.

Are bash arrays still shit?

I was working with bash and java for the last year. I like to see my arrays in a 2D plain to this bracket bullshit.

>I like to see my arrays in a 2D plain to this bracket bullshit.
Are you referring to passing Python lists to numpy's array creation method, or what?

Not that I love Python, but Java and Bash both also have lots of extreme syntax BS and lots of annoying type conversions.

I was talking about the display on stdout.

Anyway, I got it.
Look at this bullcrap.
I wanted to eliminate rows and columns written line by line in removed file.

reactivity = numpy.loadtxt(‘e1’)
error = numpy.loadtxt(‘e2’)

array=numpy.subtract(reactivity,error)

wt=array[0,:]

array = numpy.delete(array, (0), axis=0)


with open("removed", "r") as ins:
for line in ins:
b=int(line)-1
array[b,:]=-9999
array[:,b]=-9999

a=array[~np.all(array == -9999, axis = 0),:]
b=a[:,~np.all(array == -9999, axis = 0)]

This is fucking retarded, you are fucking stupid.

Make it better without fucking up the index.

Elaborate on what exactly you're trying to do

I take it you've seen the error of your ways and acknowledge that NumPy is superior

>Working with numpy arrays is such a pain in the ass!
No, it's not.

>current year
>not being overqualified for your job
>fucking monkey go code website

At least it's better than Matlabs godawful language.

load two x,x+1 arrays, put first extra row in a separate list, subtract both remaining arrays and then remove rows and columns listed in a text file.
In this text you have for eg 125,1,14
So you have to delete row and column 125,14 and one.

Haven't run this but you get the idea

reactivity = numpy.loadtxt(‘e1’)
error = numpy.loadtxt(‘e2’)

raw_array = reactivity - error

wt = raw_array[0 ,:]
array = raw_array[1: ,:]

with open("removed", "r") as ins:
to_remove = np.array(map(int, ins.readlines())) - 1

selector = ~np.isin(np.arange(len(array)), to_remove)
final_array = array[selector,:][:,selector]

How is this less complicated than my solution?
You guys are bitching for the sake of bitching.
The code doesn't have to be efficient, nor quick.
It must work.

>It must work.
Your code literally does not work if the data had an actual row of -9999 in it.

Not even considering how much less efficient your code is.

If you want to remain a shit coder that's your prerogative.

>Why can't they address arrays like normal people?
?

Try writing Excel macro instead.

>Your code literally does not work if the data had an actual row of -9999 in it.
It won't. Reactivity values go from -10 to +10.
-9999 is a good choice for a mask.

In Libre Office?
Come on Man.
Now that's a waste of time.

Do you not know what delete does?

In [1]: import numpy as np

In [2]: X = np.arange(16).reshape((4, 4))

In [3]: X
Out[3]:
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11],
[12, 13, 14, 15]])

In [4]: del_idx = [1, 3]

In [5]: for ax in range(X.ndim):
...: X = np.delete(X, del_idx, axis=ax)
...:

In [6]: X
Out[6]:
array([[ 0, 2],
[ 8, 10]])


Also, if you insist on masking, try to be less retarded and use a boolean mask.

>Do you not know what delete does?
It fucks up my index when I try to delete multiple columns and rows only based on indexes written down in removed.txt.
I need to mask columns and rows that are out and then remove them.
Anyways, I've moved on to the next step so yeah. My rant is kind of over at this point.

>It fucks up my index when I try to delete multiple columns and rows only based on indexes written down in removed.txt.
That's literally what I've done. Just delete one axis at a time. Learn to use a tool before ranting about it.

Well fuck it.
When you read your file line by line in a loop the delete operation changes the array on every step.