Merge branch 'feature/doryab_location_empty_df_fix' into develop
Adding the branch to fix infer home locations and empty dataframe.pull/130/head
commit
7815c380a2
|
@ -111,6 +111,9 @@ def haversine(lon1,lat1,lon2,lat2):
|
||||||
|
|
||||||
origDf = pd.read_csv(snakemake.input[0])
|
origDf = pd.read_csv(snakemake.input[0])
|
||||||
filteredDf = filterDatafromDf(origDf)
|
filteredDf = filterDatafromDf(origDf)
|
||||||
|
if filteredDf.empty:
|
||||||
|
filteredDf.to_csv(snakemake.output[0])
|
||||||
|
else:
|
||||||
dbscan_eps = snakemake.params["dbscan_eps"]
|
dbscan_eps = snakemake.params["dbscan_eps"]
|
||||||
dbscan_minsamples = snakemake.params["dbscan_minsamples"]
|
dbscan_minsamples = snakemake.params["dbscan_minsamples"]
|
||||||
threshold_static = snakemake.params["threshold_static"]
|
threshold_static = snakemake.params["threshold_static"]
|
||||||
|
|
|
@ -188,12 +188,14 @@ def len_stay_timeattopn(locationData,maximum_gap_allowed,maximum_row_duration):
|
||||||
calculationDf.loc[calculationDf.timeInSeconds >= maximum_gap_allowed,'timeInSeconds'] = maximum_row_duration
|
calculationDf.loc[calculationDf.timeInSeconds >= maximum_gap_allowed,'timeInSeconds'] = maximum_row_duration
|
||||||
timeArray = calculationDf.groupby('location_label')['timeInSeconds'].sum().reset_index()['timeInSeconds'].sort_values(ascending=False)/60
|
timeArray = calculationDf.groupby('location_label')['timeInSeconds'].sum().reset_index()['timeInSeconds'].sort_values(ascending=False)/60
|
||||||
|
|
||||||
if len(timeArray) > 2:
|
if len(timeArray) == 3:
|
||||||
return (timeArray[0],timeArray[1],timeArray[2],timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
return (timeArray[0],timeArray[1],timeArray[2],timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
||||||
elif len(timeArray)==2:
|
elif len(timeArray)==2:
|
||||||
return (timeArray[0],timeArray[1],None,timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
return (timeArray[0],timeArray[1],None,timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
||||||
else:
|
elif len(timeArray)==1:
|
||||||
return (timeArray[0],None,None,timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
return (timeArray[0],None,None,timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
||||||
|
else:
|
||||||
|
return (None,None,None,timeArray.max(),timeArray.min(),timeArray.std(),timeArray.mean())
|
||||||
|
|
||||||
|
|
||||||
def getMinutesData(locationData):
|
def getMinutesData(locationData):
|
||||||
|
|
Loading…
Reference in New Issue