import pandas as pd
a=("Long-term borrowings", "property assets", "short-term borrowings")
b=(1111,3333,5555)
c=(444,7777,899)
d=(345,132,5562)
df=pd.DataFrame(data=(b,c,d),index=a)
print(df)
I just want to extract the value of the row that contains the word borrowing.
pandas dataframe
Please refer to the following.
a=("long-term borrowings", "property assets", "short-term borrowings")
b=(1111,3333,5555)
c=(444,7777,899)
d=(345,132,5562)
df = pd.DataFrame(data=(b,c,d),index=a)
df.loc[df.index.str.contains("borrowing")]
0 1 2
Long-term borrowings 1111 33335555
Short-term borrowings 345 132 5562
© 2024 OneMinuteCode. All rights reserved.