import pandas as pd
Code 1:-
df = pd.DataFrame([{'First':'Bill','Last':'Thompson','AcctNum':'0001','AcctValue':100},
{'First':'James','Last':'Winters','AcctNum':'0002','AcctValue':200},
{'First':'Anna','Last':'Steele','AcctNum':'0003','AcctValue':300},
{'First':'Sean','Last':'Reilly','AcctNum':'0004','AcctValue':400}])
account_value = df.loc[df['AcctNum'] == '0003']['AcctValue'].values[0]
print(account_value)
Output=300
Code 2:-
df1=pd.DataFrame([{'randomcolumn':'12345'}])
number=df1.loc[:,'randomcolumn']
number=number.values
number.astype(int)
Output=array([12345])
I want to store Dataframe (df1) value into integer variable like df account_value? I have tried above code 1 sample example of what I want and code 2 is the sample which i tried but it is giving me array not value.
thanks in advance.