A class of functions that can call the different SNCF API's from https://data.sncf.com/, returns data as pandas dataframe or .json() object.
Project description
SNCF Api
A class of methods that can call the different SNCF API's from SNCF Open Data, returns data as a Pandas dataframe or .json() object.
That Pandas dataframe has some elements clipped.
Some of the calls can be huge, as SNCF has put a lot of data up. Some calls may even max out the api interface. list line by type is an example.
Requirements
- Pandas
- Requests
- Python 3.8
Installation
Use the package manager pip to install.
pip install sncf-api
Usage
Import the class.
import sncf_api as sncf
Call the class (with or without the line code).
sncf = sncf(903000)
Or
sncf = sncf()
Call methods.
db = sncf.list_construction_site()
To get a list of methods from class.
help(sncf)
Notes
Methods don't need to be called with arguments, only the class. The convert_to_pandas_db() method with used the data from the last method called and return a pandas dataframe.
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
License
URL's
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.