I'm trying to select the first result from an excel sheet result in a specific column for.sort_values()
import pandas as pd
df = pd.read_excel (r'/PATH/filename.xlsx')
dff = pd.DataFrame(df, columns = ['Unnamed: 4'])
sbl = dff.sort_values('Unnamed: 4')
print sbl.head(n=4)
#Unnamed: 4
27 18465
29 18532
28 18550
30 18594
How do I take the first result 27 18465
and only use 18465
for mathematical equations?
For accessing a single entry, df.at
and df.iat
are the preferred solution.
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iat.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.