pcmiler包装python包

pcmiler的Python项目详细描述


PyPI Latest ReleasePython packageCode style: blackDownloads

pcmiler公司

一个python包,用于充分利用PCMiler产品。在

安装

pip install pcmiler

BatchPro配置

配置是根据输入数据格式和计算机上的PCMiler BatchPro安装设置的。pcmiler将在c:驱动器中搜索batchw32.exe。如果找到,它将根据路径配置设置。否则,defualt设置将设置为以下值:

exe: "C:/ALK Technologies/<PCMILER VERSION DIR>/Batchpro/batchw32.exe"
infile: "C:/ALK Technologies/<PCMILER VERSION DIR>/Batchpro/df.IN"
cfgfile: "C:/ALK Technologies/<PCMILER VERSION DIR>/Batchpro/df.CFG"
outfile: "C:/ALK Technologies/<PCMILER VERSION DIR>/Batchpro/df.OUT"
logfile: "C:/ALK Technologies/<PCMILER VERSION DIR>/Batchpro/df.LOG"
origin:
    origin_city: "origin_city"
    origin_state: "origin_state"
    origin_street: "origin_street"
    origin_zipcode: "origin_zipcode"
    origin_country: "origin_country"
destination:
    dest_city: "dest_city"
    dest_state: "dest_state"
    dest_street: "dest_street"
    dest_zipcode: "dest_zipcode"
    dest_country: "dest_country"
strfmt: "1, omax, omax + 2, dmax + 2, max_city_len"

有关可用产品和许可信息的更多信息,请参见pcmiler.com/about。您的计算机上必须安装了PCMiler BatchPro才能使用pcmiler。在

BatchPro和pandas

^{pr2}$

您可以使用pcmiler.batchpro.configpcmiler.batchpro.update_config()更新这些设置。在

frompcmilerimportbatchpro# tweak default configconfig=batchpro.config(origin={"city":"new col"})# update configconfig=batchpro.update_config(config,{"exe":""})df["miles"]=batchpro.miles_series(df=df,config=config)

使用您的config获得更多控制。在

config=batchpro.config(exe="",# path to .exeinfile="",# path to .INcfgfile="",# path to .cfgorigin={"city":"","state":"","street":"","zipcode":"","country":""},destination={"city":"","state":"","street":"","zipcode":"","country":""},# character positions for [ostart, oend, dstart, dend, max_city_len]# without config it defaults to [1, omax, omax + 2, omax + dmax + 2, city length]# NOTE: " " separates origin strings from destination stringsstrfmt=[],)df["miles"]=batchpro.miles_series(df=df,config=config)

另一种方法是

frompcmilerimportbatchproorigins=batchpro.locstr_series(df,zip_col="origin_zip",address_cols=["origin_city","origin_state","origin_street"])dests=batchpro.locstr_series(df,zip_col="dest_zip",address_cols=["dest_city","dest_state","dest_street"])df["miles"]=batchpro.miles_series(origins=origins,destinations=dests)

最小输入数据

BatchPro需要的最小数据是City StateZipcode。建议添加Country。在

pcmiler.batchpro.search_for_exe(_dir: str = "c:/")

pcmiler.batchpro.search_for_exe()用于搜索完整的batchw32.exe路径。如果没有提供配置,默认行为是在c:驱动器中执行搜索。如果找不到,则使用C:/ALK Technologies/<PCMILER VERSION DIR>/Batchpro/batchw32.exe。在

csv和excel文件的CLI

在当前工作目录中创建pcmiler.yaml。完整的配置将(#18)通过这种方法也将可用。在

exe:"path/to/batchw32.exe"sheet:"sheetnameifexcel"origin:zipcode:"zipcodecolumnname"city:"citycolumnname"state:"statecolumnname"street:"streetcolumnname"destination:zipcode:"zipcodecolumnname"city:"citycolumnname"state:"statecolumnname"street:"streetcolumnname"

运行pcmiler path/to/file。您也可以运行pcmiler-gui来手动选择一个文件。在

更多cli

  • --create-yaml在当前工作目录中创建pcmiler.yaml。在
  • --debug

.日志摘要

请参阅Batchpro的.LOG文件中的运行统计信息和设置。在

$ pcmiler batch.csv
11/14/2020 06:27:58 PM | found c:\ALK Technologies\PCMILER29\Batchpro\batchw32.exe
11/14/2020 06:27:58 PM | preparing batch.csv
11/14/2020 06:27:58 PM | running Batchpro
11/14/2020 06:28:02 PM |
--SUMMARY STATISTICS--

Chunk Size                       : 2000
Calculated Sort Size        : 80000
SortChunk on=1 off=0    : 1

Started Processing               : Sat Nov 14 18:28:01 2020
Finished Processing              : Sat Nov 14 18:28:02 2020
Total Processing Time            : 0:00:01

Total number of O/D pairs        : 2
Number of O/D pairs processed    : 2
Number of errors                 : 0
Number of routes successfully run: 2
Number of pairs/second           : 2.00

In File Format                   : PCMSave, 1, 34, 36, 70, 40

-----USER OPTIONS-----

Region             - NA

Route Type         - Practical
Reports            - Out
City/Zip Routing   - Use Local Streets
Additional Options - Borders Open
FavorOneWayDivided- Yes
Distance Units     - Miles

11/14/2020 06:28:02 PM | saving results to C:\Users\pryerc\github\pcmiler\tests\pcmiler-batch.csv

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
如何使用java向dropup html/css添加项目   如何从java中的向量向量打印   Java Maven库项目模板   java使用atmosphere api还是直接使用grizzly?   java JComponent仅部分显示   如何将动态值传递给自定义注释,以从Java数据进行映射。性质   java破解已实现方法的返回类型的最佳方法?   java Netbeans在JFrame Gui布局中覆盖图像   spring java仅向登录用户显示注销按钮   java如何对com进行身份验证。谷歌。云bigquery。带有服务帐户的BigQuery`   java禁止空字符串参数和抛出RuntimeException以阻止方法继续的利弊   java分析项目中的所有JAR以获取版本和许可证信息   Java,数据库为什么要分配一个新对象,而我们可以直接将它放入数据库