Pandas中find( )方法如何使用

Pandas中find( )方法如何使用,针对这个问题,这篇文章详细介绍了相对应的分析和解答,希望可以帮助更多想解决这个问题的小伙伴找到更简单易行的方法。

Series.str.find(sub, start=0, end=None)????????,????
Series.str.rfind(sub, start=0, end=None)????????,????Series.str.index(sub, start=0, end=None)????????,????,???????
Series.str.rindex(sub, start=0, end=None)????????,????,???????
??:
sub : ???
start : ??,???
end : ??,???
??:
??Series/??Index

import pandas as pd
s = pd.Series(['A', 'B', 'C', 'Aaba', 'Baca', 'CABA', 'dog', 'cat'])print(s.str.find("a")) 0   -1 1   -1 2   -1 3    1 4    1 5   -1 6   -1 7    1dtype: int64print(s.str.rfind("a")) 0   -1 1   -1 2   -1 3    3 4    3 5   -1 6   -1 7    1dtype: int64

关于 Pandas中find( )方法如何使用问题的解答就分享到这里了,希望以上内容可以对大家有一定的帮助,如果你还有很多疑惑没有解开,可以关注行业资讯频道了解更多相关知识。