pydeflate 2.1.2__tar.gz → 2.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pydeflate-2.1.2 → pydeflate-2.1.3}/PKG-INFO +1 -1
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/__init__.py +1 -1
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/core/api.py +1 -1
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/exchange/exchangers.py +0 -1
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/sources/common.py +1 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/sources/imf.py +29 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pyproject.toml +1 -1
- {pydeflate-2.1.2 → pydeflate-2.1.3}/LICENSE +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/README.md +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/.pydeflate_data/README.md +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/core/__init__.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/core/deflator.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/core/exchange.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/core/source.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/deflate/__init__.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/deflate/deflators.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/deflate/legacy_deflate.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/exchange/__init__.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/pydeflate_config.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/settings/emu.json +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/settings/oecd_codes.json +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/sources/__init__.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/sources/dac.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/sources/world_bank.py +0 -0
- {pydeflate-2.1.2 → pydeflate-2.1.3}/pydeflate/utils.py +0 -0
|
@@ -147,6 +147,34 @@ def _compute_exchange(df: pd.DataFrame) -> pd.DataFrame:
|
|
|
147
147
|
return pd.concat([df, exchange], ignore_index=True)
|
|
148
148
|
|
|
149
149
|
|
|
150
|
+
def _create_eur_series(df: pd.DataFrame) -> pd.DataFrame:
|
|
151
|
+
"""Create a EUR series from the exchange rate data.
|
|
152
|
+
|
|
153
|
+
This function creates exchange rate data for EUR by using the exchange rate
|
|
154
|
+
from France starting from 1999.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
df (pd.DataFrame): DataFrame containing exchange rates.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
pd.DataFrame: DataFrame with the EUR exchange rate.
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
# Get France's exchange rates by year
|
|
164
|
+
eur = (
|
|
165
|
+
df.loc[lambda d: d.pydeflate_iso3 == "FRA"]
|
|
166
|
+
.loc[lambda d: d.year >= 1999]
|
|
167
|
+
.set_index("year")["EXCHANGE"]
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
# Apply France's exchange rates to rows with entity_code == 998 and matching year
|
|
171
|
+
df.loc[df.entity_code == 998, "EXCHANGE"] = df.loc[
|
|
172
|
+
df.entity_code == 998, "year"
|
|
173
|
+
].map(eur)
|
|
174
|
+
|
|
175
|
+
return df
|
|
176
|
+
|
|
177
|
+
|
|
150
178
|
def download_weo() -> None:
|
|
151
179
|
"""Download the WEO data, process it, and save it to a parquet file."""
|
|
152
180
|
logger.info("Downloading the latest WEO data...")
|
|
@@ -161,6 +189,7 @@ def download_weo() -> None:
|
|
|
161
189
|
.pipe(_compute_exchange)
|
|
162
190
|
.pipe(add_pydeflate_iso3, column="entity", from_type="regex")
|
|
163
191
|
.pipe(_pivot_concept_code)
|
|
192
|
+
.pipe(_create_eur_series)
|
|
164
193
|
.pipe(compute_exchange_deflator, base_year_measure="NGDP_D")
|
|
165
194
|
.pipe(prefix_pydeflate_to_columns)
|
|
166
195
|
.pipe(enforce_pyarrow_types)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|