我基本上只想创建一个表示文件名日期的日期列。
我的表filesInDir
只是一个列,有4行叫做filepath
:
":..\..\code\products\Q\ExtData\CIBC\availability\Global\EquityOnly\daily\bnyMellon_inventory\push_list_20190314_040253_Equity.csv"
":..\..\code\products\Q\ExtData\CIBC\availability\Global\EquityOnly\daily\bnyMellon_inventory\push_list_20190314_040306_Equity.csv"
":..\..\code\products\Q\ExtData\CIBC\availability\Global\EquityOnly\daily\bnyMellon_inventory\push_list_20190311_040321_Bond.csv"
":..\..\code\products\Q\ExtData\CIBC\availability\Global\EquityOnly\daily\bnyMellon_inventory\push_list_20190312_999999_Cash.csv"
我还有一个可能的日期列表,2019.03.12 2019.03.11 2019.03.14
。如何将日期列表与上表的行匹配,以便我可以获得一个新列,指定与filepath字符串匹配的日期值。
这是解析filePath以获取日期的方法,请注意“\”是转义符号,因此您需要写为“\\”而不是直接从系统命令检索字符串。
创建表
filesInDir:([]filePaths:(":..\\..\\code\\products\\Q\\ExtData\\CIBC\\availability\\Global\\EquityOnly\\daily\\bnyMellon_inventory\\push_list_20190314_040253_Equity.csv";
":..\\..\\code\\products\\Q\\ExtData\\CIBC\\availability\\Global\\EquityOnly\\daily\\bnyMellon_inventory\\push_list_20190314_040306_Equity.csv";
":..\\..\\code\\products\\Q\\ExtData\\CIBC\\availability\\Global\\EquityOnly\\daily\\bnyMellon_inventory\\push_list_20190311_040321_Bond.csv";
":..\\..\\code\\products\\Q\\ExtData\\CIBC\\availability\\Global\\EquityOnly\\daily\\bnyMellon_inventory\\push_list_20190312_999999_Cash.csv"))
创建日期列
update date:{"D"$("_"vs last "\\" vs x)[2]} each filePaths from `filesInDir
我还列出了可能的日期,2019.03.12 2019.03.11 2019.03.14。如何将日期列表与上表的行匹配,以便我可以获得一个新列,指定与filepath字符串匹配的日期值。
你能举一些例子吗?不清楚你打算和期望看到什么
如果你只想让一个“Flag”列表明记录中的日期是否与dateRange匹配,你可以简单地使用in
来匹配它。
dateRange:2019.03.12 2019.03.11 2019.03.14
update match:date in dateRange from `filesInDir
这将是输出:
如果您的所有文件路径都遵循与示例路径相同的格式,则可以非常轻松地创建日期列:
update date:"D"$8#'103_'filePaths from filesInDir
然后使用此列与您的日期匹配。
使用0:
的另一种方法
update date:raze(" D";"_")0:filePaths from filesInDir
它取决于文件路径中qazxsw poi的出现次数