excel_filepath = ""

csv_output_filepath = ""

"""
Explanation: Compute site visits
This notebook computes the number of visits at each sample site from an excel file exported from an online database (arcgis online) of site visits.
Required pacakges
<a href="https://github.com/pydata/pandas">pandas</a>
Variable declarations
excel_filepath – path to excel file with site visit records <br />
csv_output_filepath – path to export csv file
End of explanation
"""


import pandas

"""
Explanation: Import statements
End of explanation
"""


file = pandas.read_excel(excel_filepath)

file = file.rename_axis({'NAME':'Name', 'TIME1':'Time', 'WEATHER1':'Weather', 'TEMPERATURE1':'Temperature'}, 1)

data = file[['ID', 'Name', 'Time', 'Weather', 'Temperature']].sort_values(by=['ID', 'Name', 'Time'])

data['ID'] = data['ID'].map('{:g}'.format)

data['Name'] = [n.strip() for n in data['Name']]

counts = data['ID'].value_counts().sort_index()

names = data[['ID', 'Name']].drop_duplicates().set_index('ID')

count = names.join(counts).rename_axis({'ID':'count'}, 1)

count

data

"""
Explanation: Compute site visits
End of explanation
"""


data.to_csv(csv_output_filepath)

"""
Explanation: Export to csv
End of explanation
"""


