[英]How to get the row index of the first cell with currency formatting in the last column of a dataframe using Python Pandas
现在我有一个 dataframe:
import pandas as pd
s1 = pd.Series(['a', 'b', 'c'])
s2 = pd.Series(['e', '$200', 'f'])
s3 = pd.Series(['e', '$300', '$400'])
s4 = pd.Series(['f', '$500', '$600'])
df = pd.DataFrame([list(s1), list(s2), list(s3), list(s4)], columns = ['A', 'B', 'C'])
df
A B C
0 a b c
1 e $200 f
2 e $300 $400
3 f $500 $600
我想通过最后一列中的所有单元格 go 并尝试找到第一个具有货币格式的单元格。 第一个所需的单元格是 df['C'][2]。 我要返回的行索引是 2。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.