Skip to content

Commit 511357c

Browse files
committed
chore: make download only the default on _impl
1 parent ece11f0 commit 511357c

18 files changed

Lines changed: 588 additions & 536 deletions

File tree

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,39 @@ docker compose -f docker/docker-compose.yaml down
5252

5353
### Simplified Database Functions (New in 2.0)
5454

55-
The easiest way to get data as a pandas DataFrame:
55+
By default, the high-level convenience functions query and download data locally, returning a list of paths to the downloaded Parquet files. This allows you to inspect the file structure or load them with your preferred tool (e.g., pandas, Polars, DuckDB).
5656

5757
```python
5858
from pysus import sinan, sinasc, sim, sih, sia, pni, ibge, cnes, ciha
5959

60-
# Download SINAN Dengue data for 2000
61-
df = sinan(disease="deng", year=2000)
60+
# Download SINAN Dengue data for 2000 and return a list of Parquet paths
61+
parquet_files = sinan(disease="deng", year=2000)
6262

6363
# Multiple years
64-
df = sinan(disease="deng", year=[2023, 2024])
64+
parquet_files = sinan(disease="deng", year=[2023, 2024])
6565

6666
# SINASC births for São Paulo, 2020-2023
67-
df = sinasc(state="SP", year=[2020, 2021, 2022, 2023])
67+
parquet_files = sinasc(state="SP", year=[2020, 2021, 2022, 2023])
6868

6969
# SIM mortality data
70-
df = sim(state="SP", year=2024)
70+
parquet_files = sim(state="SP", year=2024)
7171

7272
# SIH hospitalizations with month
73-
df = sih(state="SP", year=2024, month=[1, 2, 3])
73+
parquet_files = sih(state="SP", year=2024, month=[1, 2, 3])
7474

7575
# CNES health facilities
76-
df = cnes(state="SP", year=2024, month=1)
76+
parquet_files = cnes(state="SP", year=2024, month=1)
77+
```
78+
79+
### Loading as a DataFrame Directly
80+
If you prefer to load and combine the data automatically into a single pandas DataFrame, pass the as_dataframe=True parameter to any of the functions:
81+
82+
```python
83+
import pandas as pd
84+
from pysus import sinan
85+
86+
# Download and return a concatenated pandas DataFrame
87+
df = sinan(disease="deng", year=2024, as_dataframe=True)
7788
```
7889

7990
### Listing the files

0 commit comments

Comments
 (0)