Location date features as dataframe
Project description
SpaceTimePandas
Location and date features from a bunch of api sources to Pandas. Repository hosted on GitHub.
pip install SpaceTimePandas
Temporal features
>>> import datetime
>>> from stpd.event import Holiday
>>> us_holidays = Holiday(years=[2021, 2022, 2023], country='US')
>>> us_holidays(datetime.date(2022, 1, 17))
{
'us_holiday_days_since_last': 0,
'us_holiday_days_to_next': 35
}
>>> from datetime import datetime
>>> from stpd.fourier import Fourier
>>> Fourier()(datetime(2020, 1, 1))
{
'week_of_year_sine_phase_0': 0.1198805403706726,
...
'week_of_year_sine_phase_52': 0.08569582503232778,
'week_of_year_cos_phase_0': 0.9927883238840168,
...
'minute_of_hour_cos_phase_59': 0.9945218953682733
}
Location features
>>> from stpd.openstreetmap import OpenStreetMap
>>> osm=OpenStreetMap()('Toronto Ontario')
[nominatim] downloading data: search
{
'count_natural=tree': 719,
'count_natural=water': 15,
'count_building=yes': 1151,
'count_building=house': 39,
'count_amenity=parking': 148,
'count_amenity=restaurant': 327,
'count_service=driveway': 77
}
>>> from stpd.openrouteservice import OpenRouteServicePathFeatures
>>> ors = OpenRouteServicePathFeatures(api_key='<GET-ONE-FROM-OPENROUTESERVICE>')
>>> ors(location_strs=['toronto ontario', 'hamilton ontario'])
{
'distance': 67828.8,
'duration': 3125.3
}
>>> from stpd.openrouteservice import OpenRouteServiceLocationFeatures
>>> ors = OpenRouteServiceLocationFeatures(api_key='<GET-ONE-FROM-OPENROUTESERVICE>')
>>> ors(location_str='toronto ontario')
{
'range_seconds_100.0_area': 553988.44,
'range_seconds_100.0_reachfactor': 0.0229,
'range_seconds_100.0_total_pop': 1953.0,
'range_seconds_200.0_area': 3674992.8,
...
'range_seconds_1000.0_total_pop': 942521.0
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file SpaceTimePandas-0.3.1.dev0.tar.gz.
File metadata
- Download URL: SpaceTimePandas-0.3.1.dev0.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0dbb884a974de0c043c26290faf9bd57a915456cf301247dbd62234521dbd715
|
|
| MD5 |
4527497b880d6d3a72d65787f73f5ab0
|
|
| BLAKE2b-256 |
d713c32e3b8ff068f1feef07f80029a67e2fbc66cd010e3bfdb509af09df37d2
|
File details
Details for the file SpaceTimePandas-0.3.1.dev0-py3-none-any.whl.
File metadata
- Download URL: SpaceTimePandas-0.3.1.dev0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
878273d1aa5a7bb528133deac1d427ca01004144e7b00c1b1def1a627318d674
|
|
| MD5 |
c8d52321550f76b26285824f909da2a5
|
|
| BLAKE2b-256 |
1507340db86a9727e5daaa14aef1bb666ee31dd6a7d6ac82f48765cb7a6dc0f3
|