I have a variable that reads in a datafile
dfPort = pd.read_csv("E:...\Portfolios\ConsDisc_20160701_Q.csv")
I was hoping to create three variables: portName, inceptionDate, and frequency that would read the string of the "E:..." above and take out the wanted parts of the string using the underscore as a indicator to go to next variable. Example after parsing string:
portName = "ConsDisc"
inceptionDate: "2016-07-01"
frequency: "Q"
Any tips would be appreciated!
list = "E:...\Portfolios\ConsDisc_20160701_Q.csv".split("\\")[-1].split(".")[0].split("_"); portName, inceptionDate, frequency = list[0], list[1], list[2]