如何过滤掉我不希望第一个字母为“Z”或任何其他字符的一系列数据(在 Pandas dataFrame 中)。
我有以下熊猫数据帧,df,(其中有 > 25,000 行)。
TIME_STAMP Activity Action Quantity EPIC Price Sub-activity Venue
0 2017-08-30 08:00:05.000 Allocation BUY 50 RRS 77.6 CPTY 066
1 2017-08-30 08:00:05.000 Allocation BUY 50 RRS 77.6 CPTY 066
3 2017-08-30 08:00:09.000 Allocation BUY 91 BATS 47.875 CPTY PXINLN
4 2017-08-30 08:00:10.000 Allocation BUY 43 PNN 8.07 CPTY WCAPD
5 2017-08-30 08:00:10.000 Allocation BUY 270 SGE 6.93 CPTY PROBDMAD
Run Code Online (Sandbox Code Playgroud)
我正在尝试删除 Venue 的第一个字母为“Z”的所有行。
例如,我通常的过滤器代码类似于(过滤掉 Venue = '066' 的所有行
df = df[df.Venue != '066']
Run Code Online (Sandbox Code Playgroud)
我可以看到这个过滤器行过滤掉了我需要的数组,但我不确定如何在过滤器上下文中指定它。 …