Want to get involved? We're always looking for ideas and content for Weekly Challenges.
SUBMIT YOUR IDEAMy alternative Python-based solution! #SnakingMyWayThruChallenges cc: @SeanAdams
PYTHON SCRIPT:
#################################
# Read in various packages + Alteryx start data from input 1from ayx import Alteryx
import pandas
import numpy
import datetime as dtpoems = Alteryx.read("#1").values.tolist()
#################################
# Split poems array into a list.
result = list()for i in range(len(poems)):
a = str(poems[i][0]).split(',')
result.append(a)
#################################
# Replace double quotes and then reformat datetime.for lst in result:
for j, item in enumerate(lst):
lst[j] = item.replace('"', '')if j == 2:
lst[j] = (dt.datetime.strptime(lst[j],"'%y-%b-%d'")).strftime("%Y-%m-%d")
else:
pass
#################################
output = pandas.DataFrame(result)
output = output.rename(columns={0: "Poem", 1: "Poem_ID", 2: "Poem_Read_Date"})Alteryx.write(output,1)
#################################output = pandas.DataFrame(result)
output = output.rename(columns={0: "Poem", 1: "Poem_ID", 2: "Poem_Read_Date"})Alteryx.write(output,1)
Cheers!
NJ
Here is my solution.
I made my life difficult by using Regex but I need some practice with tthat tool.