In [ ]:
#Set the user date
userDate = '7/3/2003'
In [ ]:
#Set the location classes
locClasses = '1','2','3'
In [ ]:
#import the modules
import pandas as pd
In [ ]:
#set a variable to the path where the tracking data lives
dataFilename = '.\Data\Sara.txt'
In [ ]:
#Open the data as a pandas dataframe.
df = pd.read_csv(dataFilename,
comment='#', #Skip lines that start with '#'
delimiter='\t' #Set the delimiter as <tab>
)
In [ ]:
#Create a mask of user dates
dateMask = df['utc'].str.startswith(userDate)
In [ ]:
#Create a mask of location classe
lcMask = df['lc'].isin(locClasses)
In [ ]:
#Filter the records that match the above masks
dfOutput = df[dateMask & lcMask]
In [ ]:
print "On {}, Sara the turtle was found at:".format(userDate)
for i,row in dfOutput.iterrows():
print(' {0} deg Lat; {1} deg lon'.format(row['lat1'],row['lon1']))