python有没有比较快捷的方法实现excel的vlookup功能
黄舟
黄舟 2017-04-18 09:15:34
0
4
613

我现在抓取的数据有“省”和“县”,我想根据“省、县”来匹配市。
有没有相对来说比较快捷的函数或者库或者什么方法实现?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(4)
PHPzhong

There is a python module called xlsxwriter. After downloading and installing,
import xlswriter

Let’s study how to use it

小葫芦

Then save a traversal dictionary of provinces and counties

刘奇

pandas modulepivot

左手右手慢动作

The mobile client cannot reply to comments, annoying

Then you have to read a third-party file that has this matching relationship. When reading, just use the province and county as the index and the city as the value

I don’t quite understand what you mean. There is obviously a city and a county, so why match the city? Do you want to get the price?
If you just want vlookup, panda can set the two columns as indexes, and then you can directly get the number based on the index name.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template