pandas – Using For loops in python efficiently

PFA the sample code below:

import pandas as pd
Data=pd.read_csv('C:/Users/Administrator/Desktop/required_data.csv')
required_data=Data.tail(1)

for i in required_data:
    sellingprice=required_data.average_price
    print(sellingprice)
    

The CSV File is as shown:

required_data Dataframe

The code is working fine the only issue being the selling price 103.1 is being printed 30 times which are the number of columns in the required_data dataframe.

I only want the selling price to be printed once.

The output I got is:

runfile('C:/Users/Administrator/Desktop/Live_Trading/untitled1.py', wdir='C:/Users/Administrator/Desktop/Live_Trading')

35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64
35    103.1
Name: average_price, dtype: float64

The expected output is:

runfile('C:/Users/Administrator/Desktop/Live_Trading/untitled1.py', wdir='C:/Users/Administrator/Desktop/Live_Trading')
    
    35    103.1
    Name: average_price, dtype: float64