pydeflate 2.0.0__py3-none-any.whl → 2.0.2__py3-none-any.whl
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/__init__.py +1 -1
- pydeflate/core/api.py +2 -2
- pydeflate/core/exchange.py +4 -4
- pydeflate/sources/common.py +10 -1
- {pydeflate-2.0.0.dist-info → pydeflate-2.0.2.dist-info}/METADATA +1 -1
- {pydeflate-2.0.0.dist-info → pydeflate-2.0.2.dist-info}/RECORD +8 -8
- {pydeflate-2.0.0.dist-info → pydeflate-2.0.2.dist-info}/LICENSE +0 -0
- {pydeflate-2.0.0.dist-info → pydeflate-2.0.2.dist-info}/WHEEL +0 -0
pydeflate/__init__.py
CHANGED
pydeflate/core/api.py
CHANGED
|
@@ -318,9 +318,9 @@ class BaseDeflate:
|
|
|
318
318
|
pd.Series: Series with combined deflator values.
|
|
319
319
|
"""
|
|
320
320
|
return (
|
|
321
|
-
(
|
|
321
|
+
(exchange_def * exchange_rate) / price_def
|
|
322
322
|
if self.to_current
|
|
323
|
-
else
|
|
323
|
+
else price_def / (exchange_def * exchange_rate)
|
|
324
324
|
)
|
|
325
325
|
|
|
326
326
|
def _merge_components(self, df: pd.DataFrame, other: pd.DataFrame):
|
pydeflate/core/exchange.py
CHANGED
|
@@ -110,17 +110,17 @@ class Exchange:
|
|
|
110
110
|
pydeflate_EXCHANGE=lambda d: d.pydeflate_EXCHANGE / d.pydeflate_EXCHANGE_to
|
|
111
111
|
)
|
|
112
112
|
|
|
113
|
-
# Drop unnecessary columns
|
|
114
|
-
merged = merged.drop(columns=merged.filter(regex="_to$").columns, axis=1)
|
|
115
|
-
|
|
116
113
|
# Compute the exchange rate deflator
|
|
117
114
|
merged = compute_exchange_deflator(
|
|
118
115
|
merged,
|
|
119
|
-
exchange="
|
|
116
|
+
exchange="pydeflate_EXCHANGE_to",
|
|
120
117
|
year="pydeflate_year",
|
|
121
118
|
grouper=["pydeflate_entity_code", "pydeflate_iso3"],
|
|
122
119
|
)
|
|
123
120
|
|
|
121
|
+
# Drop unnecessary columns
|
|
122
|
+
merged = merged.drop(columns=merged.filter(regex="_to$").columns, axis=1)
|
|
123
|
+
|
|
124
124
|
return merged
|
|
125
125
|
|
|
126
126
|
def exchange(
|
pydeflate/sources/common.py
CHANGED
|
@@ -207,6 +207,13 @@ def compute_exchange_deflator(
|
|
|
207
207
|
exchange: str = "EXCHANGE",
|
|
208
208
|
year: str = "year",
|
|
209
209
|
) -> pd.DataFrame:
|
|
210
|
+
|
|
211
|
+
# if needed, clean exchange name
|
|
212
|
+
if exchange.endswith("_to") or exchange.endswith("_from"):
|
|
213
|
+
exchange_name = exchange.rsplit("_", 1)[0]
|
|
214
|
+
else:
|
|
215
|
+
exchange_name = exchange
|
|
216
|
+
|
|
210
217
|
# Identify the base year for the deflator
|
|
211
218
|
if measure is not None:
|
|
212
219
|
base_year = identify_base_year(group, measure=measure, year=year)
|
|
@@ -222,7 +229,9 @@ def compute_exchange_deflator(
|
|
|
222
229
|
|
|
223
230
|
# If base value is found and valid, calculate the deflator
|
|
224
231
|
if base_value.size > 0 and pd.notna(base_value[0]):
|
|
225
|
-
group[f"{
|
|
232
|
+
group[f"{exchange_name}_D"] = round(
|
|
233
|
+
100 * group[exchange] / base_value[0], 6
|
|
234
|
+
)
|
|
226
235
|
|
|
227
236
|
return group
|
|
228
237
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
pydeflate/.pydeflate_data/README.md,sha256=atNtUL9dD8G184YSd6juFib8TgEQBcSLogiz99APPVs,25
|
|
2
|
-
pydeflate/__init__.py,sha256=
|
|
2
|
+
pydeflate/__init__.py,sha256=ucS093TzuhZ6Gxr-GQ4KCMU6RY0vqCZjemGukpcc_kM,975
|
|
3
3
|
pydeflate/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
pydeflate/core/api.py,sha256
|
|
4
|
+
pydeflate/core/api.py,sha256=-MpFRtn9H99B72M_m3-dwQe9zp0gUkBJJhMaG8iDcBU,14329
|
|
5
5
|
pydeflate/core/deflator.py,sha256=Ax3dmOF3tYRZnkIfFvMMo3SOLgAJHkXSmA-OtIUZkp0,5932
|
|
6
|
-
pydeflate/core/exchange.py,sha256=
|
|
6
|
+
pydeflate/core/exchange.py,sha256=br6RVgTGa7LW09XemUJZ4Koazf65zuXPQKYKGhS6ROM,8535
|
|
7
7
|
pydeflate/core/source.py,sha256=tIN9fAPhhE-6C5Ye608qTMQblm3yva7u5p1nJwepXm4,1724
|
|
8
8
|
pydeflate/deflate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
pydeflate/deflate/deflators.py,sha256=hyLFoX46BAn5m8gTLjw-TFv3x3W6CTQmvmUvq5a_cio,7768
|
|
@@ -14,12 +14,12 @@ pydeflate/pydeflate_config.py,sha256=5s4SLJf5is5XcUgJHDRx4f27pPiaVh0H2BL8w9QjW0k
|
|
|
14
14
|
pydeflate/settings/emu.json,sha256=BIvbiMUeHUtCESR3sMcBNrS028yp2YraCJdhDJGvAAo,133
|
|
15
15
|
pydeflate/settings/oecd_codes.json,sha256=jAKI1EgQP4rttjoG3Z-44r1tUJrIEzPCZF5V2aboQhE,911
|
|
16
16
|
pydeflate/sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
|
-
pydeflate/sources/common.py,sha256=
|
|
17
|
+
pydeflate/sources/common.py,sha256=ctSL2JQ_6kVSSGkh7UphU98G-HTJL0s8JvSMic-EGnY,9881
|
|
18
18
|
pydeflate/sources/dac.py,sha256=ngFiApGZ_tIQg74ogGVTIbGUA0efnF1SYwfUuqGofOQ,3791
|
|
19
19
|
pydeflate/sources/imf.py,sha256=10vc8xhNJvANb7RDD1WFn9oaZ8g53yUV5LxCQCz6ImM,6337
|
|
20
20
|
pydeflate/sources/world_bank.py,sha256=YxQgUUDMXlPArIfvYJTjNIAU5_I_OeUYDzc7NtTq9EA,6288
|
|
21
21
|
pydeflate/utils.py,sha256=sfocGBQook3S7gvutCFovknyCv0cV37MHPJB-EMIumQ,2321
|
|
22
|
-
pydeflate-2.0.
|
|
23
|
-
pydeflate-2.0.
|
|
24
|
-
pydeflate-2.0.
|
|
25
|
-
pydeflate-2.0.
|
|
22
|
+
pydeflate-2.0.2.dist-info/LICENSE,sha256=q5tm9mQxwSbV5Ivvjxs7MMqBgan6DM8I4r4irPvmqZM,1075
|
|
23
|
+
pydeflate-2.0.2.dist-info/METADATA,sha256=myZ1BRAU-zIm3N4uLXUslMJuyGFQNWmGmCcIqldOCf8,12582
|
|
24
|
+
pydeflate-2.0.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
25
|
+
pydeflate-2.0.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|