【R_爬虫】爬取MRC水位数据_越努力,越幸运-CSDN博客代码#------------------------get data to .rds-------------message(Sys.time())if (!requireNamespace("jsonlite", quietly = TRUE)) install.packages("jsonlite",dependencies = T)station <- jsonlite::fromJSON("https://api.mrcmekong.org/api/v1/nrtm...https://blog.csdn.net/YWP_2016/article/details/117511914?spm=1001.2014.3001.5501
from openpyxl import load_workbook
from openpyxl.styles import Border, Side, PatternFill, Font, GradientFill, Alignment
import pandas as pd
df = pd.read_excel("D:\\202110 MRC\\MRC_yuanshi.xlsx")
df1= df[df['stationId']==92600]
df2= df[df['stationId']==92980]
df3= df[df['stationId']==10402]
df4= df[df['stationId']==11201]
df5= df[df['stationId']==11501]
df6= df[df['stationId']==11901]
df7= df[df['stationId']==12703]
df8= df[df['stationId']==13102]
df9= df[df['stationId']==13806]
df10= df[df['stationId']==13901]
df11= df[df['stationId']==13905]
df12= df[df['stationId']==100102]
df13= df[df['stationId']==120101]
df14= df[df['stationId']==230113]
df15= df[df['stationId']==260101]
df16= df[df['stationId']==270101]
df17= df[df['stationId']==270502]
df18= df[df['stationId']==320107]
df19= df[df['stationId']==320101]
df20= df[df['stationId']==350102]
df21= df[df['stationId']==350101]
df22= df[df['stationId']==350105]
df23= df[df['stationId']==360106]
df24= df[df['stationId']==390102]
df25= df[df['stationId']==430106]
df26= df[df['stationId']==10501]
df27= df[df['stationId']==11903]
df28= df[df['stationId']==12001]
df29= df[df['stationId']==13101]
df30= df[df['stationId']==13402]
df31= df[df['stationId']==13801]
df32= df[df['stationId']==50106]
df33= df[df['stationId']==70103]
df34= df[df['stationId']==150101]
df35= df[df['stationId']==290102]
df36= df[df['stationId']==290113]
df37= df[df['stationId']==14003]
df38= df[df['stationId']==14501]
df39= df[df['stationId']==14901]
df40= df[df['stationId']==430102]
df41= df[df['stationId']==440102]
df42= df[df['stationId']==450101]
df43= df[df['stationId']==20102]
df44= df[df['stationId']==33401]
df45= df[df['stationId']==33402]
df46= df[df['stationId']==530101]
df47= df[df['stationId']==550102]
df48= df[df['stationId']==20106]
df49= df[df['stationId']==590101]
df50= df[df['stationId']==610101]
df51= df[df['stationId']==19905]
df52= df[df['stationId']==640102]
df53= df[df['stationId']==680103]
df54= df[df['stationId']==19803]
df55= df[df['stationId']==39801]
df56= df[df['stationId']==980601]
df57= df[df['stationId']==19804]
df58= df[df['stationId']==39803]
df59= df[df['stationId']==908001]
df60= df[df['stationId']==908002]
df61= df[df['stationId']==985203]
df62= df[df['stationId']==440201]
df63= df[df['stationId']==451305]
df64= df[df['stationId']==450502]
df65= df[df['stationId']==450701]
df66= df[df['stationId']==902602]
df67= df[df['stationId']==902601]
df68= df[df['stationId']==901503]
with pd.ExcelWriter('D:\\202110 MRC\\MRC9.xlsx', engine='openpyxl') as writer:
df1.drop('stationId', axis=1).to_excel(writer, sheet_name='Jinghong', index=False)
df2.drop('stationId', axis=1).to_excel(writer, sheet_name='Manan', index=False)
df3.drop('stationId', axis=1).to_excel(writer, sheet_name='XiengKok', index=False)
df4.drop('stationId', axis=1).to_excel(writer, sheet_name='LuangPrabang', index=False)
df5.drop('stationId', axis=1).to_excel(writer, sheet_name='BanPakhoung', index=False)
df6.drop('stationId', axis=1).to_excel(writer, sheet_name='VientianeKM4', index=False)
df7.drop('stationId', axis=1).to_excel(writer, sheet_name='Paksane', index=False)
df8.drop('stationId', axis=1).to_excel(writer, sheet_name='Thakhek', index=False)
df9.drop('stationId', axis=1).to_excel(writer, sheet_name='BanMaiSingsamphan', index=False)
df10.drop('stationId', axis=1).to_excel(writer, sheet_name='Pakse', index=False)
df11.drop('stationId', axis=1).to_excel(writer, sheet_name='DonSahong', index=False)
df12.drop('stationId', axis=1).to_excel(writer, sheet_name='MuongNgoy', index=False)
df13.drop('stationId', axis=1).to_excel(writer, sheet_name='BanMixai', index=False)
df14.drop('stationId', axis=1).to_excel(writer, sheet_name='Phiengluang', index=False)
df15.drop('stationId', axis=1).to_excel(writer, sheet_name='MuangKao', index=False)
df16.drop('stationId', axis=1).to_excel(writer, sheet_name='Phonesy', index=False)
df17.drop('stationId', axis=1).to_excel(writer, sheet_name='BanNape', index=False)
df18.drop('stationId', axis=1).to_excel(writer, sheet_name='Mahaxai', index=False)
df19.drop('stationId', axis=1).to_excel(writer, sheet_name='SeBangfai', index=False)
df20.drop('stationId', axis=1).to_excel(writer, sheet_name='Phalane', index=False)
df21.drop('stationId', axis=1).to_excel(writer, sheet_name='BanKengdone', index=False)
df22.drop('stationId', axis=1).to_excel(writer, sheet_name='Sopnam', index=False)
df23.drop('stationId', axis=1).to_excel(writer, sheet_name='BanSebangnouane', index=False)
df24.drop('stationId', axis=1).to_excel(writer, sheet_name='Khongsedone', index=False)
df25.drop('stationId', axis=1).to_excel(writer, sheet_name='BanVeunkhen', index=False)
df26.drop('stationId', axis=1).to_excel(writer, sheet_name='ChiangSaen', index=False)
df27.drop('stationId', axis=1).to_excel(writer, sheet_name='ChiangKhan', index=False)
df28.drop('stationId', axis=1).to_excel(writer, sheet_name='NongKhai', index=False)
df29.drop('stationId', axis=1).to_excel(writer, sheet_name='NakhonPhanom', index=False)
df30.drop('stationId', axis=1).to_excel(writer, sheet_name='Mukdahan', index=False)
df31.drop('stationId', axis=1).to_excel(writer, sheet_name='KhongChiam', index=False)
df32.drop('stationId', axis=1).to_excel(writer, sheet_name='BanDoiHang', index=False)
df33.drop('stationId', axis=1).to_excel(writer, sheet_name='Thoeng', index=False)
df34.drop('stationId', axis=1).to_excel(writer, sheet_name='WangSaphung', index=False)
df35.drop('stationId', axis=1).to_excel(writer, sheet_name='BanThaKokDaeng', index=False)
df36.drop('stationId', axis=1).to_excel(writer, sheet_name='BanHadPaeng', index=False)
df37.drop('stationId', axis=1).to_excel(writer, sheet_name='KohKey', index=False)
df38.drop('stationId', axis=1).to_excel(writer, sheet_name='StungTreng', index=False)
df39.drop('stationId', axis=1).to_excel(writer, sheet_name='Kratie', index=False)
df40.drop('stationId', axis=1).to_excel(writer, sheet_name='Siempang', index=False)
df41.drop('stationId', axis=1).to_excel(writer, sheet_name='VoeunSai', index=False)
df42.drop('stationId', axis=1).to_excel(writer, sheet_name='Lumphat', index=False)
df43.drop('stationId', axis=1).to_excel(writer, sheet_name='PrekKdam', index=False)
df44.drop('stationId', axis=1).to_excel(writer, sheet_name='Chaktomuk', index=False)
df45.drop('stationId', axis=1).to_excel(writer, sheet_name='KohKhel', index=False)
df46.drop('stationId', axis=1).to_excel(writer, sheet_name='Sisophon', index=False)
df47.drop('stationId', axis=1).to_excel(writer, sheet_name='Battambang', index=False)
df48.drop('stationId', axis=1).to_excel(writer, sheet_name='KompongLuong', index=False)
df49.drop('stationId', axis=1).to_excel(writer, sheet_name='Boribo', index=False)
df50.drop('stationId', axis=1).to_excel(writer, sheet_name='KompongThom', index=False)
df51.drop('stationId', axis=1).to_excel(writer, sheet_name='KampongAmpil', index=False)
df52.drop('stationId', axis=1).to_excel(writer, sheet_name='KompongSpeu', index=False)
df53.drop('stationId', axis=1).to_excel(writer, sheet_name='Angkorborey', index=False)
df54.drop('stationId', axis=1).to_excel(writer, sheet_name='TanChau', index=False)
df55.drop('stationId', axis=1).to_excel(writer, sheet_name='ChauDoc', index=False)
df56.drop('stationId', axis=1).to_excel(writer, sheet_name='VamNao', index=False)
df57.drop('stationId', axis=1).to_excel(writer, sheet_name='MyThuan', index=False)
df58.drop('stationId', axis=1).to_excel(writer, sheet_name='CanTho', index=False)
df59.drop('stationId', axis=1).to_excel(writer, sheet_name='ChoLach', index=False)
df60.drop('stationId', axis=1).to_excel(writer, sheet_name='MyHoa', index=False)
df61.drop('stationId', axis=1).to_excel(writer, sheet_name='VamKenh', index=False)
df62.drop('stationId', axis=1).to_excel(writer, sheet_name='Kontum', index=False)
df63.drop('stationId', axis=1).to_excel(writer, sheet_name='BanDon', index=False)
df64.drop('stationId', axis=1).to_excel(writer, sheet_name='GiangSon', index=False)
df65.drop('stationId', axis=1).to_excel(writer, sheet_name='DucXuyen', index=False)
df66.drop('stationId', axis=1).to_excel(writer, sheet_name='ViThanh', index=False)
df67.drop('stationId', axis=1).to_excel(writer, sheet_name='PhungHiep', index=False)
df68.drop('stationId', axis=1).to_excel(writer, sheet_name='LongDinh', index=False)