Glider
Loading...
Searching...
No Matches
SlackerTemplate.py
Go to the documentation of this file.
1import re
2from pandas import read_csv
3
5 def date(self, filename):
6 """Sets date column given the filename (it contains the date)
7 For example gyrostream-pty-ltd_slacker_202301_Monthly-Sales.txt
8 Args:
9 filename (str): current filename
10 Returns: date_str (str)
11 """
12 date = re.findall(r'_20\d{4}_', filename)[0]
13 date = date.replace("_", "")
14 date_str = date[:4]+"-"+date[4:]+"-01"
15 return date_str