import numpy as np
import pandas as pd
newdf = pd.DataFrame(np.random.rand(7, 5), index=np.arange(7))
newdf.columns = list("ABCDE")
print("\n\nnewdf is\n")
print(newdf)
newdf = newdf.drop("B", axis=1)
print(newdf)
print("\n\n\nbut now it is:\n\n")
print(newdf.loc[[1, 2], ["C", "D"]])
print("Now we will print values which are less than 0.5\n\n")
print(newdf.iloc[(newdf[0] < 0.5)])
I want to print some particular values using index numbers, but it shows some error with newdf.iloc
that ChatGPT can’t solve, why?