I am trying to calculate the regression of the x
and y
variables, trace_no
and twwt
, respectively.
The variable are 151 x 1
arrays.
The code is outputting a syntax error:
File "./seabed_dip_correction.py", line 32
slope, intercept, r_value, p_value, std_err, Syy/Sxx = stats.linregress(trace_no,twtt)
SyntaxError: can't assign to operator
I have tried switching the operator around i.e. stats.linregress() = ...
but that doesn't work.
Here is my code, could someone please tell me where I am going wrong?
data=np.genfromtxt('trace1_offset_gather.dat')
trace_no=data[:,[0]]
twtt=data[:,[1]]
slope, intercept, r_value, p_value, std_err, Syy/Sxx = stats.linregress(trace_no,twtt)
Your last variable, or rather pair of variables, is invalid.
If that is supposed to be a single variable, know that you cannot have
/
in your variable name.Python identifiers and keywords
If that is meant to be two variables, you cannot assign a value to an expression like this, it would be like saying
That makes sense in mathematics, but not in Python, you must assign a value to a single variable, or in the case of unpacking
N
values toN
variables.Edit
The function
scipy.stats.linregress
only returns 5 values, and they are