{"library":"stats-can","title":"StatsCan Data Reader for Python","type":"library","description":"Stats-can is a Python library designed to easily read data from Statistics Canada into pandas DataFrames. It simplifies access to the StatsCan API, allowing users to fetch specific data cubes by ID and apply filters for dimensions like geography, time, and characteristics. The current version is 3.2.3, with major releases refactoring the API for robustness, and minor releases addressing bug fixes and performance improvements.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install stats-can"],"cli":null},"imports":["from statscan import Statscan"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":"https://github.com/ianepreston/stats_can","docs":"https://stats-can.readthedocs.io","changelog":null,"pypi":"https://pypi.org/project/stats-can/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"from statscan import Statscan\nimport pandas as pd\n\n# Initialize the Statscan client\nsc = Statscan()\n\n# Fetch data for a specific cube ID (e.g., '17-10-0007-01' for Consumer Price Index)\ndf = sc.get_data(\"17-10-0007-01\")\n\n# Print the first few rows of the DataFrame\nprint(df.head())\n\n# You can also specify filters, e.g., for specific geographies or dates\n# df_filtered = sc.get_data(\n#     \"17-10-0007-01\",\n#     filters={\n#         'GEO': ['Canada', 'Ontario'],\n#         'REF_DATE': ['2023-01', '2023-02']\n#     }\n# )\n# print(df_filtered.tail())","lang":"python","description":"This quickstart demonstrates how to initialize the Statscan client and fetch data for a given Statistics Canada data cube ID. The data is returned as a pandas DataFrame. It also shows a commented example for applying basic filters.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}