https://github.com/apachecn-archive/chinese_province_city_area_mapper
https://github.com/apachecn-archive/chinese_province_city_area_mapper
Science Score: 13.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (4.2%) to scientific vocabulary
Repository
Basic Info
- Host: GitHub
- Owner: apachecn-archive
- License: mit
- Language: Python
- Default Branch: master
- Size: 617 KB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 0
Metadata Files
README.MD
python
["461585", ""]
| | | | |
||||461585 |
|||| |
python3
pip install cpca
:cpcachinese province city area
ModuleNotFoundError: No module named 'jieba'
pip install jieba
star
cpca/resources/pca.csv2019220
Get Started
cpca.transformlistpandasSeriesDataFrame
python
location_str = ["461585", "", ""]
import cpca
df = cpca.transform(location_str)
df
0 461585
1
2
dfPandasDataFrameDataFramecsvexcelDataFramePandashttp://pandas.pydata.org/pandas-docs/version/0.20/dsintro.html#dataframe
""DataFramecsv
pos_sensitive=True
python
location_str = ["461585", "", ""]
import cpca
df = cpca.transform(location_str, pos_sensitive=True)
df
_pos _pos _pos
0 461585 -1 -1 0
1 -1 0 3
2 -1 -1 0
_pos_pos_pos-1-1
transformcutTruecutFalse
transformumap
python
location_str = ["461585", "", ""]
import cpca
df = cpca.transform(location_str, umap={})
df
```
0 461585
1
2
```
umapcpca.py
python
myumap = {'': '',
'': '',
'': '',
'': '',
'': '',
'': '',
'': '',
'': '',
'': '',
'': ''}
"" """" """" umap
python
location_str = ["89"]
import cpca
df = cpca.transform(location_str)
df
```
0 89 ```
WARNING:root: , umap
,transformopen_warningFalse
python
import cpca
cpca.province_area_map.get_relational_addrs(('', ''))
python
[('', '', ''), ('', '', '')]
transformumap
python
location_str = ["89"]
import cpca
df = cpca.transform(location_str, umap={"":""})
df
```
0 89
``
python
location_str = ["89"]
import cpca
df = cpca.transform(location_str)
df
```
0 89 ```
concatindextransformindex(datalistpandas)
python
location_str = ["461585", "", ""]
import cpca
df = cpca.transform(location_str, index=["2018","2017","2016"])
df
```
2018 461585
2017
2016
```
jieba
python
location_str = ["403"]
import cpca
df = cpca.transform(location_str)
df
```
0 403 ```
jieba:
python
location_str = ["403"]
import cpca
df = cpca.transform(location_str, cut=False)
df
```
0 403 ```
8(transformlookahead8)
lookahead
python
location_str = ["403"]
import cpca
df = cpca.transform(location_str, cut=False, lookahead=3)
df
python
import cpca
cpca.transform(["111591118"], cut=False, pos_sensitive=True)
:
_pos _pos _pos
0 111591118 -1 -1 25
.
foliumpip install folium .
```python from cpca import drawer
dfdf
drawer.draw_locations(df, "df.html") ```
df.html ''''''

```python
from cpca import latlng latlng[('','','')] #('39.95895316640668', '116.52169489108084')
""
from cpca import areamap areamap.getrelationaladdrs('') #[('', '', ''), ('', '', ''), ('', '', ''), ('', '', '')]
: citymap, provincemap
"", ""
from cpca import provinceareamap provinceareamap.getrelationaladdrs(('', '')) # [('', '', ''), ('', '', '')] ```
- """"""""
```python
location_strs = ["256", "256"]
import cpca df = cpca.transform(location_strs) df ```
```
0 256 1 256 ```
""""""""
```python import cpca
locationstr = ["","","",""] df = cpca.transform(locationstr) df ```
```
0
1
2
3
```
cpca/__init__.py7896
```python
location_strs = ["256"]
import cpca df = cpca.transform(location_strs) df ```
python
import cpca
cpca.transform(["111591118"], cut=False, pos_sensitive=True)
:
_pos _pos _pos
0 111591118 -1 -1 25
""""
**
```python
import pandas as pd origin = pd.read_csv("tests/addr.csv")
import cpca addr_df = cpca.transform(origin[""])
processed = pd.concat([origin, addrdf], axis=1) processed.tocsv("processed.csv", index=False, encoding="utf-8") ```
warnningwarnningumap.
1
foliumpip install foliumfolium
```python from cpca import drawer
processedprocessed
drawer.draw_locations(processed, "processed.html") ```
"processed.html"folium

2echarts:
foliumecharts.
pip install pyecharts
pip install echarts-countries-pypkg
pip install pyecharts-snapshot
processed
python
from cpca import drawer
drawer.echarts_draw(processed, "echarts.html")
python
def echarts_draw(locations, file_path, title=""
, subtitle="location distribute"):
"""
echartshtml.
:param locations: , pandasdataframe.
:param file_path: html.
:param title:
:param subtitle:
"""
echarts.html

3()
python
from cpca import drawer
drawer.echarts_cate_draw(processed, processed[""], "echarts_cate.html")
echarts_cate.html

python
def echarts_cate_draw(locations, labels, file_path, title="", subtitle="location distribute",
point_size=7):
"""
echartshtml.
:param locations: , pandasdataframe.
:param labels: locations, .
:param file_path: html.
:param title:
:param subtitle:
:param point_size:
"""
How to Contribute
testspython setup.py test
PR
END
issue
Owner
- Name: ApacheCN 归档
- Login: apachecn-archive
- Kind: organization
- Email: wizard.z@qq.com
- Repositories: 180
- Profile: https://github.com/apachecn-archive
防止重要项目丢失而设立的归档
GitHub Events
Total
Last Year
Dependencies
- Jinja2 >=2.10.1
- echarts-countries-pypkg *
- folium *
- jieba *
- mock *
- pandas *
- pandoc *
- pyecharts <=0.5.11
- pyecharts-snapshot *
- pytest *
- travis-encrypt *
- twine *
- urllib3 >=1.24.2
- appdirs ==1.4.3
- asn1crypto ==0.24.0
- atomicwrites ==1.3.0
- attrs ==19.1.0
- bleach ==3.1.0
- branca ==0.3.1
- certifi ==2019.9.11
- cffi ==1.12.3
- chardet ==3.0.4
- click ==7.0
- colorama ==0.4.1
- cryptography ==2.7
- docutils ==0.15.2
- dukpy ==0.2.2
- echarts-countries-pypkg ==0.1.6
- folium ==0.10.0
- future ==0.17.1
- idna ==2.8
- importlib-metadata ==0.22
- javascripthon ==0.10
- jieba ==0.39
- jinja2 ==2.10.1
- jupyter-echarts-pypkg ==0.1.2
- lml ==0.0.2
- macropy3 ==1.1.0b2
- markupsafe ==1.1.1
- mock ==3.0.5
- more-itertools ==7.2.0
- numpy ==1.17.2
- packaging ==19.1
- pandas ==0.25.1
- pandoc ==1.0.2
- pillow ==6.1.0
- pkginfo ==1.5.0.1
- pluggy ==0.13.0
- ply ==3.11
- py ==1.8.0
- pycparser ==2.19
- pyecharts ==0.5.11
- pyecharts-javascripthon ==0.0.6
- pyecharts-jupyter-installer ==0.0.3
- pyecharts-snapshot ==0.2.0
- pyee ==6.0.0
- pygments ==2.4.2
- pyparsing ==2.4.2
- pyperclip ==1.7
- pyppeteer ==0.0.25
- pytest ==5.1.2
- python-dateutil ==2.8.0
- python-dotenv ==0.10.3
- pytz ==2019.2
- pyyaml ==5.1.2
- readme-renderer ==24.0
- requests ==2.22.0
- requests-toolbelt ==0.9.1
- six ==1.12.0
- tqdm ==4.35.0
- travis-encrypt ==1.3.1
- twine ==1.14.0
- urllib3 ==1.25.3
- wcwidth ==0.1.7
- webencodings ==0.5.1
- websockets ==8.0.2
- zipp ==0.6.0