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.
- Pandas
- Requests
- Python 3.8
Use the package manager pip to install.
pip install sncf-api
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)
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.
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.