Getting/setting values using integer-based labeling with iloc

The .iloc attribute works very similarly to the .loc attribute, except that it uses the integer positions of the rows and columns being accessed, not their labels. In the following example, the value in the 101st row (not the 100th row, since indexing starts at 0) and the 100th column is transferred to scalar_value:

value2 = df3.iloc[0,5]
print(value2)

The output is 7.0.

Note that, similarly to .loc, lists containing multiple values can be passed to the .iloc attribute to change multiple entries of a DataFrame at once.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset