Glider
Loading...
Searching...
No Matches
MediaNetTemplate.py
Go to the documentation of this file.
1import re
2
4 def date(self, filename):
5 """Sets date column given the filename (it contains the date)
6 For example WW_MediaNet_GYROstream_2022-08-01_2022-08-31_Plays.csv
7 Args:
8 filename (str): current filename
9 Returns: date_str (str)
10 """
11 # "WW_MediaNet_GYROstream_2022-08-01_2022-08-31_Plays.csv"
12 date = re.findall(r'_\d{4}-\d{2}-\d{2}', filename)[0]
13 date=date.replace("_", "")
14 date=date.replace("-", "")
15 year = date[:4]
16 month = date[4:6]
17 day = date[6:]
18 date_str = year+"-"+month+"-"+day
19 return date_str