基于唯一标识符从CSV提取行

zc0qhyus  于 2023-09-27  发布在  其他
关注(0)|答案(1)|浏览(109)

在本例中,有6个唯一源(列)
你能告诉我如何提取最后6个独特的行的基础上源列。
除了导入CSV之外。我有点糊涂了。我们的想法是在一个变量中总是有6个最新的数据。

"Date","Instance","(I) Market","Last","Trend","Market","Position","Pos Qty","Time","Avg Price","Open Profit/Loss","Daily Profit/Loss","NewDailyProfit/LossHigh","NewDailyProfit/LossLow","Today Maximum Runup","Today Maximum Drawdown","Today Total Trades","Today Losing Trades","Today Winning Trades","Weekly Closed Profit/Loss","Weekly Total Trades","Weekly Winning Trades","Weekly Losing Trades","Maximum Drawdown","Maximum Runup","NewMaxDraw","NewMaxRunup","Source","Write Time"
"2023-9-06","1","(1) F.US.CLEV23","86.75","▼","F.US.CLEV23","Flat","0","10:24:35","0.00","0.00","-1120.00","No","No","120","-1120","4","3","1","-8690","4","1","3","-1120.00","120.00","No","No","S:\SierraChart\Data\F.US.CLEV23_AutoCharts-DataExport.csv","10:25:39.000000"
"2023-9-06","1","(1) F.US.GCEZ23","1945.3","▼","F.US.GCEZ23","Short","-2","10:25:30","1945.10","-40.0","10.0","No","No","150","-140","2","1","1","-5930","2","1","1","-140.00","150.00","No","No","S:\SierraChart\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:25:44.000000"
"2023-9-06","1","(1) F.US.ENQU23","15415.25","▼","F.US.ENQU23","Flat","0","10:25:15","0.00","0.00","1000.00","No","No","1790","-790","11","7","4","-37570","11","4","7","-790.00","1790.00","No","No","S:\SierraChart\Data\F.US.ENQU23_AutoCharts-DataExport.csv","10:25:40.000000"
"2023-9-06","2","(2) F.US.GCEZ23","1945.3","▼","F.US.GCEZ23","Short","-4","10:25:15","1946","300.0","-680.0","No","No","0","-680","1","1","0","-420","1","0","1","-680.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:25:39.000000"
"2023-9-06","1","(1) F.US.CLEV23","86.74","▼","F.US.CLEV23","Flat","0","10:24:35","0.00","0.00","-1120.00","No","No","120","-1120","4","3","1","-8690","4","1","3","-1120.00","120.00","No","No","S:\SierraChart\Data\F.US.CLEV23_AutoCharts-DataExport.csv","10:25:49.000000"
"2023-9-06","1","(1) F.US.ENQU23","15410.50","▼","F.US.ENQU23","Flat","0","10:25:39","0.00","0.00","1000.00","No","No","1790","-790","11","7","4","-37570","11","4","7","-790.00","1790.00","No","No","S:\SierraChart\Data\F.US.ENQU23_AutoCharts-DataExport.csv","10:25:53.000000"
"2023-9-06","2","(2) F.US.GCEZ23","1945.0","▼","F.US.GCEZ23","Short","-4","10:25:15","1946","420.0","-680.0","No","No","0","-680","1","1","0","-420","1","0","1","-680.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:25:49.000000"
"2023-9-06","1","(1) F.US.EPU23","4473.75","▼","F.US.EPU23","Short","-2","10:25:10","4477.75","400.00","1387.50","No","No","2587.5","-600","6","2","4","0","0","0","0","-600.00","2587.50","No","No","S:\SierraChart\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:25:55.000000"
"2023-9-06","1","(1) F.US.CLEV23","86.74","▼","F.US.CLEV23","Flat","0","10:24:35","0.00","0.00","-1120.00","No","No","120","-1120","4","3","1","-8690","4","1","3","-1120.00","120.00","No","No","S:\SierraChart\Data\F.US.CLEV23_AutoCharts-DataExport.csv","10:25:59.000000"
"2023-9-06","1","(1) F.US.GCEZ23","1944.8","▼","F.US.GCEZ23","Short","-2","10:25:30","1945.10","60.0","10.0","No","No","150","-140","2","1","1","-5930","2","1","1","-140.00","150.00","No","No","S:\SierraChart\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:25:54.000000"
"2023-9-06","2","(2) F.US.EPU23","4473.75","▼","F.US.EPU23","Long","6","10:25:10","4479.25","-1725.00","0.00","No","No","0","0","0","0","0","-14125","0","0","0","0.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:25:55.000000"
"2023-9-06","2","(2) F.US.GCEZ23","1944.8","▼","F.US.GCEZ23","Short","-4","10:25:15","1946","500.0","-680.0","No","No","0","-680","1","1","0","-420","1","0","1","-680.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:25:59.000000"
"2023-9-06","1","(1) F.US.EPU23","4473.75","▼","F.US.EPU23","Short","-2","10:25:10","4477.75","400.00","1387.50","No","No","2587.5","-600","6","2","4","0","0","0","0","-600.00","2587.50","No","No","S:\SierraChart\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:26:05.000000"
"2023-9-06","1","(1) F.US.GCEZ23","1944.7","▼","F.US.GCEZ23","Short","-2","10:25:30","1945.10","80.0","10.0","No","No","150","-140","2","1","1","-5930","2","1","1","-140.00","150.00","No","No","S:\SierraChart\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:26:04.000000"
"2023-9-06","1","(1) F.US.CLEV23","86.72","▼","F.US.CLEV23","Flat","0","10:24:35","0.00","0.00","-1120.00","No","No","120","-1120","4","3","1","-8690","4","1","3","-1120.00","120.00","No","No","S:\SierraChart\Data\F.US.CLEV23_AutoCharts-DataExport.csv","10:26:09.000000"
"2023-9-06","2","(2) F.US.EPU23","4473.75","▼","F.US.EPU23","Long","6","10:25:10","4479.25","-1725.00","0.00","No","No","0","0","0","0","0","-14125","0","0","0","0.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:26:05.000000"
"2023-9-06","2","(2) F.US.GCEZ23","1944.8","▼","F.US.GCEZ23","Short","-4","10:25:15","1946","460.0","-680.0","No","No","0","-680","1","1","0","-420","1","0","1","-680.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:26:09.000000"
"2023-9-06","1","(1) F.US.EPU23","4474.50","▼","F.US.EPU23","Short","-2","10:25:10","4477.75","300.00","1387.50","No","No","2587.5","-600","6","2","4","0","0","0","0","-600.00","2587.50","No","No","S:\SierraChart\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:26:15.000000"
"2023-9-06","1","(1) F.US.GCEZ23","1944.9","▼","F.US.GCEZ23","Short","-2","10:25:30","1945.10","20.0","10.0","No","No","150","-140","2","1","1","-5930","2","1","1","-140.00","150.00","No","No","S:\SierraChart\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:26:14.000000"
"2023-9-06","1","(1) F.US.ENQU23","15410.00","▼","F.US.ENQU23","Flat","0","10:25:39","0.00","0.00","1000.00","No","No","1790","-790","11","7","4","-37570","11","4","7","-790.00","1790.00","No","No","S:\SierraChart\Data\F.US.ENQU23_AutoCharts-DataExport.csv","10:26:13.000000"
"2023-9-06","2","(2) F.US.EPU23","4474.50","▼","F.US.EPU23","Long","6","10:25:10","4479.25","-1425.00","0.00","No","No","0","0","0","0","0","-14125","0","0","0","0.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:26:15.000000"
"2023-9-06","2","(2) F.US.GCEZ23","1944.8","▼","F.US.GCEZ23","Short","-4","10:25:15","1946","460.0","-680.0","No","No","0","-680","1","1","0","-420","1","0","1","-680.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:26:19.000000"
"2023-9-06","1","(1) F.US.GCEZ23","1944.7","▼","F.US.GCEZ23","Short","-2","10:25:30","1945.10","80.0","10.0","No","No","150","-140","2","1","1","-5930","2","1","1","-140.00","150.00","No","No","S:\SierraChart\Data\F.US.GCEZ23_AutoCharts-DataExport.csv","10:26:24.000000"
"2023-9-06","1","(1) F.US.EPU23","4473.50","▼","F.US.EPU23","Short","-2","10:25:10","4477.75","400.00","1387.50","No","No","2587.5","-600","6","2","4","0","0","0","0","-600.00","2587.50","No","No","S:\SierraChart\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:26:25.000000"
"2023-9-06","1","(1) F.US.ENQU23","15413.50","▲","F.US.ENQU23","Flat","0","10:25:39","0.00","0.00","1000.00","No","No","1790","-790","11","7","4","-37570","11","4","7","-790.00","1790.00","No","No","S:\SierraChart\Data\F.US.ENQU23_AutoCharts-DataExport.csv","10:26:23.000000"
"2023-9-06","2","(2) F.US.EPU23","4473.50","▼","F.US.EPU23","Long","6","10:25:10","4479.25","-1725.00","0.00","No","No","0","0","0","0","0","-14125","0","0","0","0.000","0.000","No","No","S:\SierraChart\SierraChartInstance_2\Data\F.US.EPU23_AutoCharts-DataExport.csv","10:26:25.000000"

我希望返回突出显示的行。(6个最新和唯一)

7ivaypg9

7ivaypg91#

看起来下面的方法应该可以做到这一点,按Source对行进行分组,然后对每个组按Write Time(* 降序 *)进行排序,最后选择第一行(latest)。

Import-Csv path\to\csv.csv | Group-Object Source | ForEach-Object {
    $_.Group | Sort-Object 'Write Time' -Descending | Select-Object -First 1
}

相关问题