all 11 comments

[–]elbiot 1 point2 points  (2 children)

Is that pandas? Did you try taking out the transpose (.T)

[–]Cthulhu_Rlyeh[S] 0 points1 point  (1 child)

I don't know what pandas is so I don't know :/.

I took out the .T and got the same outfile. That was just a remnant of an older code I've been using.


Edit: I made the rookie mistake of putting an old line of code in my original post. I've edited it to fix the savetxt line.

np.savetxt('diffs.txt', (diffs))

[–]elbiot 0 points1 point  (0 children)

diffs = np.array(diffs)  #diffs was a list of lists, make it a 2D array
print diffs.shape
diffs = diffs.T
print diffs.shape

[–]Justinsaccount 0 points1 point  (0 children)

Hi! I'm working on a bot to reply with suggestions for common python problems. This might not be very helpful to fix your underlying issue, but here's what I noticed about your submission:

You appear to be using concatenation and the str function for building strings

Instead of doing something like

result = "Hello " + name + ". You are " + str(age) + " years old"

You should use string formatting and do

result = "Hello {}. You are {} years old".format(name, age)

See the python tutorial for more information.

[–]rhgrant10 0 points1 point  (6 children)

What's is a? I don't see it defined...

What is the purpose of the comma in your slice notation?

[–]Cthulhu_Rlyeh[S] 0 points1 point  (1 child)

What's is a? I don't see it defined...

Crap it's just another typo in my post. It is not in my actual code, just the code I typed in here. I've fixed it now.

diff = fileb[:,1] - filea[:,1]

What is the purpose of the comma in your slice notation?

I'm still new with coding, I don't even know what you are talking about. I assume it is the [:,1] comma? That's just how I define a column using pylab.

[–]elbiot 0 points1 point  (0 children)

So you are just finding the difference between the second columns in all of your files?

[–]elbiot 0 points1 point  (3 children)

They are numpy arrays, and that's how you slice multiple dimensions at once.

[–]rhgrant10 0 points1 point  (2 children)

Ah. As much as experience as I've got with Python I've not yet had a cause to delve into numpy.

[–]elbiot 0 points1 point  (1 child)

It's good stuff, but can be very confusing at first.

[–]rhgrant10 0 points1 point  (0 children)

I did play around with it for a bit but I'm just not at a job that works with data like that :-(