Private
Public Access
1
0

removing obsolete .ix calls to pandas

This commit is contained in:
Sander Roosendaal
2019-02-09 08:52:52 +01:00
parent a5d8dbdf07
commit b88c6e902a
13 changed files with 93 additions and 85 deletions

View File

@@ -327,11 +327,11 @@ def createc2workoutdata_as_splits(w):
maxhr = int(df[' HRCur (bpm)'].max())
# adding diff, trying to see if this is valid
t = 10*df.ix[:,' ElapsedTime (sec)'].diff().values
t = 10*df.loc[:,' ElapsedTime (sec)'].diff().values
t[0] = t[1]
d = df.ix[:,' Horizontal (meters)'].diff().values
d = df.loc[:,' Horizontal (meters)'].diff().values
d[0] = d[1]
p = 10*df.ix[:,' Stroke500mPace (sec/500m)'].values
p = 10*df.loc[:,' Stroke500mPace (sec/500m)'].values
t = t.astype(int)
d = d.astype(int)
p = p.astype(int)
@@ -396,11 +396,11 @@ def createc2workoutdata(w):
maxhr = 0
# adding diff, trying to see if this is valid
t = 10*row.df.ix[:,'TimeStamp (sec)'].values-10*row.df.ix[0,'TimeStamp (sec)']
t = 10*row.df.loc[:,'TimeStamp (sec)'].values-10*row.df.loc[:,'TimeStamp (sec)'].iloc[0]
t[0] = t[1]
d = 10*row.df.ix[:,' Horizontal (meters)'].values
d = 10*row.df.loc[:,' Horizontal (meters)'].values
d[0] = d[1]
p = abs(10*row.df.ix[:,' Stroke500mPace (sec/500m)'].values)
p = abs(10*row.df.loc[:,' Stroke500mPace (sec/500m)'].values)
p = np.clip(p,0,3600)
if w.workouttype == 'bike':
p = 2.0*p
@@ -817,35 +817,35 @@ def add_workout_from_data(user,importid,data,strokedata,
unixtime = cum_time+starttimeunix
# unixtime[0] = starttimeunix
seconds = 0.1*strokedata.ix[:,'t']
seconds = 0.1*strokedata.loc[:,'t']
nr_rows = len(unixtime)
try:
latcoord = strokedata.ix[:,'lat']
loncoord = strokedata.ix[:,'lon']
latcoord = strokedata.loc[:,'lat']
loncoord = strokedata.loc[:,'lon']
except:
latcoord = np.zeros(nr_rows)
loncoord = np.zeros(nr_rows)
try:
strokelength = strokedata.ix[:,'strokelength']
strokelength = strokedata.loc[:,'strokelength']
except:
strokelength = np.zeros(nr_rows)
dist2 = 0.1*strokedata.ix[:,'d']
dist2 = 0.1*strokedata.loc[:,'d']
try:
spm = strokedata.ix[:,'spm']
spm = strokedata.loc[:,'spm']
except KeyError:
spm = 0*dist2
try:
hr = strokedata.ix[:,'hr']
hr = strokedata.loc[:,'hr']
except KeyError:
hr = 0*spm
pace = strokedata.ix[:,'p']/10.
pace = strokedata.loc[:,'p']/10.
pace = np.clip(pace,0,1e4)
pace = pace.replace(0,300)