I am preparing code for pandas3.0 and I noticed that the original syntax df['b'].iloc[0]
causes a lot of future warnings.
Is there an alternative, more elegant way to express this instead of using df.loc[df.index[0], 'b'] = 9
. It seems much less elegant.
import pandas as pd
df = pd.DataFrame(dict(a=[1, 2, 3], b=[2, 3, 4]))
df['b'].iloc[0] = 9
df.loc[df.index[0], 'b'] = 9