I have a def where it is pulling data from a CSV file and only showing a certain row & column. The issue I am having is when printing it adds a "none" row at the end.
def last_3rd_price():
df1 = pd.read_csv('test.csv')
row_start = df1.index[-3]
row_end = df1.index[-3]
last_3rd_price = df1.loc[row_start:row_end, 'Price']
for price in last_3rd_price:
print(price)
print(last_3rd_price())
Data:
7129.32 Dec-15-2019 12:32:37
7129.32 Dec-15-2019 12:32:43
7129.32 Dec-15-2019 12:33:11
7129.26 Dec-15-2019 12:34:35
7129.26 Dec-15-2019 12:34:40
7129.26 Dec-15-2019 12:35:15
7129.26 Dec-15-2019 12:35:33
7127.56 Dec-15-2019 12:42:51
7128.43 Dec-15-2019 12:44:39
Here is the output:
7129.26
None
I would like to know how to get rid of the last none line. I have tried to use drop() & dropna() with no success
lower_case_with_underscoresstyle.