之前发布了用Python实现地理探测器一文,但当时实现的地理探测器功能仍不完善,比如在因子探测时缺乏p值。这次更新了一下,主要改动如下:
- 因子探测结果输出p值。
- 交互探测结果输出交互类型。
代码已经开源到了GitHub,网址是https://github.com/djw-easy/GeoDetector。
下面介绍一下怎么用,基本与上一版相同。
1 导入模块
pandas
用于读取数据,factor_dector
、interaction_detector
、ecological_detector
分别是因子探测器、交互作用探测器和生态探测器。
import pandas as pd
from geodetector import (
factor_dector,
interaction_detector,
ecological_detector
)
2 读取数据
3 因子探测
4 交互作用探测
默认不输出交互类型。
输出交互类型。