countryinfo
A python module for returning data about countries, ISO info and states/provinces within them.
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (7.4%) to scientific vocabulary
Keywords
Repository
A python module for returning data about countries, ISO info and states/provinces within them.
Basic Info
- Host: GitHub
- Owner: porimol
- License: mit
- Language: Python
- Default Branch: main
- Size: 1.28 MB
Statistics
- Stars: 155
- Watchers: 5
- Forks: 48
- Open Issues: 31
- Releases: 1
Topics
Metadata Files
README.md
Country Info
A python module for returning data about countries, ISO info and states/provinces within them.
Table of Contents
APIs
- .info()
- .provinces()
- .alt_spellings()
- .area()
- .borders()
- .calling_codes()
- .capital()
- .capital_latlng()
- .currencies()
- .demonym()
- .geojson()`
- .iso()
- .languages()
- .latlng()
- .native_name()
- .population()
- .region()
- .subregion()
- .timezones()
- .tld()
- .translations()
- .wiki()
- .google()
- .all()
Acknowledgement
Install
python
pip install countryinfo
OR, git clone
```python git clone https://github.com/porimol/countryinfo.git
cd countryinfo python setup.py install ```
API Usage
To access one of the country properties available, you'll need to use one of the API methods listed below and pass a country in either way.
.info()
Returns all available information for a specified country.
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.info()
returns object,
{ 'ISO': { 'alpha2': 'SG', 'alpha3': 'SGP' }, 'altSpellings': [ 'SG', 'Singapura', 'Republik Singapura', '新加坡共和国' ], 'area': 710, 'borders': [], 'callingCodes': ['65'], 'capital': 'Singapore', 'capital_latlng': [ 1.357107, 103.819499 ], 'currencies': ['SGD'], 'demonym': 'Singaporean', 'flag': '', 'geoJSON': {}, 'languages': [ 'en', 'ms', 'ta', 'zh' ], 'latlng': [ 1.36666666, 103.8 ], 'name': 'Singapore', 'nativeName': 'Singapore', 'population': 5469700, 'provinces': ['Singapore'], 'region': 'Asia', 'subregion': 'South-Eastern Asia', 'timezones': ['UTC+08:00'], 'tld': ['.sg'], 'translations': { 'de': 'Singapur', 'es': 'Singapur', 'fr': 'Singapour', 'it': 'Singapore', 'ja': 'シンガポール' }, 'wiki': 'http://en.wikipedia.org/wiki/singapore', 'google': 'https://www.google.com/search?q=Singapore' }
Similar can also be achieved via country code or any
alternate name of a country. For example, Singapur
would be:
country = CountryInfo('SG') ```
.provinces()
Return provinces list
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.provinces()
returns object,
['Singapore'] ```
.alt_spellings()
Returns alternate spellings for the name of a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.alt_spellings()
returns list of strings, alternate names
['SG', 'Singapura', 'Republik Singapura', '新加坡共和国']
```
.area()
Returns area (km²) for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.area()
returns number of square kilometer area
710 ```
.borders()
Returns bordering countries (ISO3) for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.borders()
returns array of strings, ISO3 codes of countries that border the given country
[] ```
.calling_codes()
Returns international calling codes for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.calling_codes()
returns array of calling code strings
['65'] ```
.capital()
Returns capital city for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.capital()
returns string
'Singapore' ```
.capital_latlng()
Returns capital city latitude and longitude for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.capital_latlng()
returns array, approx latitude and longitude for country capital
[1.357107, 103.819499] ```
.currencies()
Returns official currencies for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.currencies()
returns array of strings, currencies
['SGD']
```
.demonym()
Returns the demonyms for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.demonym()
returns string, name of residents
'Singaporean' ```
.geo_json()
Returns geoJSON for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Bangladesh') country.geo_json()
returns object of GeoJSON data
{ 'features': [ { 'geometry': { 'coordinates': [[[92.672721, 22.041239], [92.652257, 21.324048], [92.303234, 21.475485], [92.368554, 20.670883], [92.082886, 21.192195], [92.025215, 21.70157], [91.834891, 22.182936], [91.417087, 22.765019], [90.496006, 22.805017], [90.586957, 22.392794], [90.272971, 21.836368], [89.847467, 22.039146], [89.70205, 21.857116], [89.418863, 21.966179], [89.031961, 22.055708], [88.876312, 22.879146], [88.52977, 23.631142], [88.69994, 24.233715], [88.084422, 24.501657], [88.306373, 24.866079], [88.931554, 25.238692], [88.209789, 25.768066], [88.563049, 26.446526], [89.355094, 26.014407], [89.832481, 25.965082], [89.920693, 25.26975], [90.872211, 25.132601], [91.799596, 25.147432], [92.376202, 24.976693], [91.915093, 24.130414], [91.46773, 24.072639], [91.158963, 23.503527], [91.706475, 22.985264], [91.869928, 23.624346], [92.146035, 23.627499], [92.672721, 22.041239]]], 'type': 'Polygon' }, 'id': 'BGD', 'properties': {'name': 'Bangladesh'}, 'type': 'Feature'}], 'type': 'FeatureCollection' }
```
.iso()
Returns ISO codes for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.iso()
returns object of ISO codes
{'alpha2': 'SG', 'alpha3': 'SGP'}
country.iso(2)
returns object of ISO codes
'SG'
country.iso(3)
returns object of ISO codes
'SGP' ```
.languages()
Returns official languages for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.languages()
returns array of language codes
['en', 'ms', 'ta', 'zh'] ```
.latlng()
Returns approx latitude and longitude for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.latlng()
returns array, approx latitude and longitude for country
[1.36666666, 103.8] ```
.native_name()
Returns the name of the country in its native tongue
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.native_name()
returns string, name of country in native language
'Singapore' ```
.population()
Returns approximate population for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.population()
returns number, approx population
5469700 ```
.region()
Returns general region for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.region()
returns string
'Asia' ```
.subregion()
Returns a more specific region for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.subregion()
returns string
'South-Eastern Asia' ```
.timezones()
Returns all timezones for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.timezones()
returns array of timezones
['UTC+08:00'] ```
.tld()
Returns official top level domains for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.tld()
returns array of top level domains specific to the country
['.sg'] ```
.translations()
Returns translations for a specified country name in popular languages
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.translations()
returns object of translations of country name in major languages
{ 'de': 'Singapur', 'es': 'Singapur', 'fr': 'Singapour', 'it': 'Singapore', 'ja': 'シンガポール' } ```
.wiki()
Returns link to wikipedia page for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.wiki()
returns string URL of wikipedia article on country
'http://en.wikipedia.org/wiki/singapore' ```
.google()
Returns link to google page for a specified country
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo('Singapore') country.google()
returns string URL of google page on country
'https://www.google.com/search?q=Singapore' ```
.all()
Returns array of objects containing all available data for all countries. This will be super big. Not recommended.
```python
coding=utf-8
from countryinfo import CountryInfo
country = CountryInfo() country.all()
returns array of objects,
{ 'zimbabwe': {'ISO': {'alpha2': 'ZW', 'alpha3': 'ZWE'}, 'altSpellings': ['ZW', 'Republic of Zimbabwe'], 'area': 390757, 'borders': ['BWA', 'MOZ', 'ZAF', 'ZMB'], 'callingCodes': ['263'], 'capital': 'Harare', 'capital_latlng': [-17.831773, 31.045686], 'currencies': ['USD'], 'demonym': 'Zimbabwean', 'flag': '', 'geoJSON': {'features': [{'geometry': {'coordinates': [[[31.191409, -22.25151], [30.659865, -22.151567], [30.322883, -22.271612], [29.839037, -22.102216], [29.432188, -22.091313], [28.794656, -21.639454], [28.02137, -21.485975], [27.727228, -20.851802], [27.724747, -20.499059], [27.296505, -20.39152], [26.164791, -19.293086], [25.850391, -18.714413], [25.649163, -18.536026], [25.264226, -17.73654], [26.381935, -17.846042], [26.706773, -17.961229], [27.044427, -17.938026], [27.598243, -17.290831], [28.467906, -16.4684], [28.825869, -16.389749], [28.947463, -16.043051], [29.516834, -15.644678], [30.274256, -15.507787], [30.338955, -15.880839], [31.173064, -15.860944], [31.636498, -16.07199], [31.852041, -16.319417], [32.328239, -16.392074], [32.847639, -16.713398], [32.849861, -17.979057], [32.654886, -18.67209], [32.611994, -19.419383], [32.772708, -19.715592], [32.659743, -20.30429], [32.508693, -20.395292], [32.244988, -21.116489], [31.191409, -22.25151]]], 'type': 'Polygon'}, 'id': 'ZWE', 'properties': {'name': 'Zimbabwe'}, 'type': 'Feature'}], 'type': 'FeatureCollection'}, 'languages': ['en', 'sn', 'nd'], 'latlng': [-20, 30], 'name': 'Zimbabwe', 'nativeName': 'Zimbabwe', 'population': 13061239, 'provinces': ['Bulawayo', 'Harare', 'ManicalandMashonaland Central', 'Mashonaland East', 'Mashonaland'], 'region': 'Africa', 'subregion': 'Eastern Africa', 'timezones': ['UTC+02:00'], 'tld': ['.zw'], 'translations': {'de': 'Simbabwe', 'es': 'Zimbabue', 'fr': 'Zimbabwe', 'it': 'Zimbabwe', 'ja': 'ジンバブエ'}, 'wiki': 'http://en.wikipedia.org/wiki/zimbabwe', 'google': 'https://www.google.com/search?q=Zimbabwe'} } ```
Special Thanks
Special thanks to johan for his work on johan/world.geo.json, who made the geojson portion of this build possible.
Inspired By
Repo: countryjs
Maintainer: Oz Haven
Contributing
See the list of contributors who participated in this project.
How to become a contributor
If you want to contribute to countryinfo and make it better, your help is very welcome.
You can make constructive, helpful bug reports, feature requests and the noblest of all contributions.
If like to contribute in a good way, then follow the following guidelines.
How to make a clean pull request
- Create a personal fork on Github.
- Clone the fork on your local machine.(Your remote repo on Github is called
origin.) - Add the original repository as a remote called
upstream. - If you created your fork a while ago be sure to pull upstream changes into your local repository.
- Create a new branch to work on! Branch from
dev. - Implement/fix your feature, comment your code.
- Follow
countryinfo's code style, including indentation(4 spaces). - Write or adapt tests as needed.
- Add or change the documentation as needed.
- Push your branch to your fork on Github, the remote
origin. - From your fork open a pull request to the
devbranch. - Once the pull request is approved and merged, please pull the changes from
upstreamto your local repo and delete your extra branch(es).
Disclaimer
This is being maintained in the contributor's free time, and as such, may contain minor errors in regards to some countries. Most of the information included in this library is what is listed on Wikipedia. If there is an error, please let me know and I will do my best to correct it.
License
The MIT License
Copyright (c) 2018, Porimol Chandro porimolchandroroy@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Owner
- Name: Porimol Chandro
- Login: porimol
- Kind: user
- Location: Dhaka, Bangladesh
- Company: @bKash @bKash-Developer
- Repositories: 11
- Profile: https://github.com/porimol
Data Science, Deep Learning & Natural Language Processing Practitioner.
Citation (CITATION.cff)
# This CITATION.cff file was generated with cffinit.
cff-version: 1.2.0
title: Country Info
version: 0.1.2
date-released: 2018-05-03
url: "https://github.com/porimol/countryinfo"
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Porimol
family-names: Chandro
email: porimolchandroroy@gmail.com
GitHub Events
Total
- Create event: 3
- Release event: 1
- Issues event: 9
- Watch event: 20
- Delete event: 3
- Issue comment event: 5
- Push event: 21
- Pull request review event: 5
- Pull request event: 9
- Fork event: 5
Last Year
- Create event: 3
- Release event: 1
- Issues event: 9
- Watch event: 20
- Delete event: 3
- Issue comment event: 5
- Push event: 21
- Pull request review event: 5
- Pull request event: 9
- Fork event: 5
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Jeremy Singh | j****9@g****m | 14 |
| Daniel Migault | m****z@g****m | 9 |
| FELIX CHERUIYOT | f****x@i****m | 8 |
| Fayas Noushad | 7****d | 6 |
| Porimol Chandro | p****l | 6 |
| David Breuer | n****e@e****m | 4 |
| Kasper Sørensen | i****n@g****m | 4 |
| sentinel-1 | 9****1 | 4 |
| dilettagoglia | d****a@g****m | 3 |
| Vinzenz Hersche | v****z@y****o | 2 |
| praneetshekhar | 1****r | 2 |
| arslanhashmi | m****9@g****m | 2 |
| Simon Kohlmeyer | s****r@g****m | 2 |
| Jannik | j****k@o****e | 1 |
| Jeremys11 | j****6@g****m | 1 |
| Jonathan Wadin | j****n@c****m | 1 |
| Pascal Corpet | p****t | 1 |
| Paweł Piotr Przeradowski | s****6@g****m | 1 |
| ProPegasus | 8****s | 1 |
| Sohan Alva | s****7@g****m | 1 |
| Porimol Chandro | i****o@e****m | 1 |
| atifiu | 4****u | 1 |
| sgonsal | s****l@i****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 44
- Total pull requests: 31
- Average time to close issues: 6 months
- Average time to close pull requests: 8 months
- Total issue authors: 37
- Total pull request authors: 25
- Average comments per issue: 1.5
- Average comments per pull request: 0.26
- Merged pull requests: 25
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 7
- Pull requests: 5
- Average time to close issues: 3 days
- Average time to close pull requests: 10 minutes
- Issue authors: 6
- Pull request authors: 4
- Average comments per issue: 0.57
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- MehdiDRISSIB (3)
- voidus (3)
- thisismyuniquegithubusername (2)
- Lama09 (2)
- hersche (2)
- lauratinnel (1)
- Chuukwudi (1)
- avivav (1)
- duartenina (1)
- hamza-hadda (1)
- Risto0211 (1)
- gweber2 (1)
- dilettagoglia (1)
- konstantinstadler (1)
- rkaldy (1)
Pull Request Authors
- porimol (3)
- kaspersorensen (3)
- Jeremys11 (3)
- mglt (2)
- SP5LMA (2)
- FayasNoushad (2)
- ProPegasus (2)
- pcorpet (2)
- Jnyame21 (2)
- atifiu (2)
- sentinel-1 (2)
- unluckynelson (2)
- sohansolo (2)
- wadinj (2)
- arslanhashmi (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 119,765 last-month
- Total docker downloads: 27,503
- Total dependent packages: 4
- Total dependent repositories: 836
- Total versions: 2
- Total maintainers: 1
pypi.org: countryinfo
countryinfo is a python module for returning data about countries, ISO info and states/provinces within them.
- Homepage: https://github.com/porimol/countryinfo
- Documentation: https://countryinfo.readthedocs.io/
- License: MIT License
-
Latest release: 0.1.2
published over 5 years ago