pip install pandas
import pandas as pd
execel_path = 'xxxx\\xxx\\xxx'
house=pd.read_excel(excel_path)
print(house.shape) # 通过shape关键字可以得到excel有多少行多少列
house.房租=house.房租.str.split('元',expand=Ture)[0].astype("int") #expand=Ture 用后面的替代前面的
print(house.sort_balues(‘房租‘).tail(5) ) # tail 降序,取出前5个。
print(house.sort_balues(‘房租‘).head(5) ) # tail 升序序,取出前5个。
house.区域.value_counts() # 返回区域发布了多少条租房信息
print (house[house.房租》=280000]['房租'])
house_5=house.loc[:5] #读出5条数据
house_5.to_excel('house_5.xlsx',index=Fase)
house_5_path='xxx\\xxxx'
house_5=pd.read_excel(house_5_path)
newdata=house_5.drop_duplicates(subset=['楼盘名称','户型'],keep=‘first’) # 删除第一次出现的