有没有办法仅提取紧接着包含type
= 'Email'的行之后的第一行?
样例表格:
id type details
1 Email admin@sqlfiddle.com
2 1234 1234
3 Email orange@hotmail.com
4 12345 12345
5 123456 123456
6 Email cake@hotmail.com
7 1234567 1234567
8 12345678 12345678
9 123456789 123456789
10 Email lala@gmail.com
11 01 01
12 Email apple@yahoo.ca
13 012 012
14 Email red@gmail.com
15 0123 0123
使用Python和Pandas,我会写出如下代码...
indexes = table[table['type']=='Email'].index + 1
table = table.ix[indexes]
输出结果将会是什么...
2 1234 1234
4 12345 12345
7 1234567 1234567
11 01 01
13 012 012
15 0123 0123