Glider
Loading...
Searching...
No Matches
BoomplayTemplate.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 gyrostream-pty-ltd_boomplay_202207_Monthly-Sales_TERR1.txt
7 Args:
8 filename (str): current filename
9 Returns: date_str (str)
10 """
11 # 'gyrostream-pty-ltd_boomplay_202207_Monthly-Sales_TERR1.txt'
12 date = re.findall(r'_20\d{4}', filename)[0]
13 date = date.replace("_", "")
14 date_str = date[:4]+"-"+date[4:]+"-01"
15 # df["date_from_file"] = date_str
16 # df["date_from_file"] = df["date_from_file"].astype("datetime64")
17 return date_str