# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3.9.5 64-bit
#     name: python395jvsc74a57bd0bd4c67ef142469da7dc4d338a32ac40116904d26076b8e6aa587d80720bc6a2b
# ---

from datetime import datetime
starttime=datetime.strptime("20180301095416","%Y%m%d%H%M%S")
# print(starttime.day)
endtime = datetime.strptime("20180301100225","%Y%m%d%H%M%S")
# starttime, endtime = endtime, starttime
delta = endtime - starttime
min_total = round(delta.seconds / 60)
print(min_total)

# +
from datetime import datetime
import pandas as pd

# filename = "data/Subway_20180301.txt"
filename = "data/Subway_20190301_top100000.txt"
# res = {}
df = pd.read_csv(filename)


# -

def time_group(etime:datetime.time) -> int:
    return etime.hour * 6 + (etime.minute // 10) + 1


# + tags=[]
for _, line in df.iterrows():
    starttime = datetime.strptime(str(line["UpTime"]), "%Y%m%d%H%M%S")
    endtime = datetime.strptime(str(line["DownTime"]), "%Y%m%d%H%M%S")
    if starttime.day != 1 or endtime.day != 1:
        continue
    delta = endtime - starttime
    if delta.days < 0:
        continue
    if delta.seconds > 7200:
        continue
    if _ > 100:
        break
    print(starttime,time_group(starttime))
# -

newindex = {}
for i in range(144):
    hour = i // 6
    dec_min = i % 6
    newindex[i] = str(hour).rjust(2,'0') + ":" + str(dec_min * 10).rjust(2,'0') + '-' + str(hour).rjust(2,'0') + ":" + str(dec_min * 10 + 9).rjust(2,'0')
print(newindex)


# +
import pandas as pd
df = pd.read_csv("./out/PeopleInSubwayTime.csv")
data = [df.iloc[:,0].tolist(), df.iloc[:,1].tolist()]
df = pd.read_csv("./out/PeopleInSubwayCount.csv")
data = [df.iloc[:, 0].tolist(), df.iloc[:, 1].tolist()]

print(data)
# -

from mytool import csv2js
csv2js()

StarcoderdataJupyterScriptsDedupFiltered