df.loc[,["列名]]
列名加[] 返回值是dataframe,不加返回的Series
current_district = district_city.loc[district_city["TOLLGATE_ID"]==gate_current,["district"]]
current_district
Out[4]:
district
416 天河区
type(current_district)
Out[5]: pandas.core.frame.DataFrame
current_district2 = district_city.loc[district_city["TOLLGATE_ID"]==gate_current,"district"]
current_district2
Out[7]:
416 天河区
Name: district, dtype: object
type(current_district2)
Out[8]: pandas.core.series.Series