Skip to content

Commit 17475e1

Browse files
author
Giulio Massacci
committed
new file trasport data
1 parent 1a5e3c3 commit 17475e1

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

terra-update-batch/modules/cosmoOutput.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,19 +1037,21 @@ def createOutputGraphExtraUE(input_path, output_tr_extra_ue_file, output_tr_prod
10371037
appo = pd.read_csv(
10381038
input_path + os.sep + f,
10391039
sep=params.SEP,
1040+
names=params.TRANSPORT_COLNAMES,
1041+
header=0,
10401042
low_memory=False,
10411043
keep_default_na=False,
10421044
na_values=[""],
10431045
)
10441046
listDataframes.append(appo)
10451047

10461048
df = pd.concat(listDataframes, axis=0)
1047-
# df=df[df["PRODUCT_NST07_NST07"]!="TOT"]
1049+
# df=df[df["PRODUCT_NSTR"]!="TOT"]
10481050
df = df[df["DECLARANT_ISO"] != "EU"]
10491051
df = df[df["PARTNER_ISO"] != "EU"]
10501052
df = df[
10511053
[
1052-
"PRODUCT_NST07_NST07",
1054+
"PRODUCT_NSTR",
10531055
"DECLARANT_ISO",
10541056
"PARTNER_ISO",
10551057
"PERIOD",
@@ -1059,7 +1061,6 @@ def createOutputGraphExtraUE(input_path, output_tr_extra_ue_file, output_tr_prod
10591061
"QUANTITY_IN_KG",
10601062
]
10611063
]
1062-
df.rename(columns={'PRODUCT_NST07_NST07': 'PRODUCT_NSTR'}, inplace=True)
10631064
df_tot = df.groupby([
10641065
"DECLARANT_ISO",
10651066
"PARTNER_ISO",

terra-update-batch/resources/params.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
PAGE_BASKET_TIME_INTERVAL_M : int = int(os.getenv("PAGE_BASKET_TIME_INTERVAL_M", "60"))
6060

6161
PREFIX_PRODUCT : str = "full_v2_"
62-
PREFIX_TRANSPORT: str = "nst07_extra"
62+
PREFIX_TRANSPORT: str = "nst07_extra_v2_"
6363
PREFIX_MAP : dict[str, str] = {
64-
"nst07_extra": "transport",
64+
"nst07_extra_v2_": "transport",
6565
"full_v2_": "product"
6666
}
6767

@@ -293,6 +293,19 @@
293293
"SUP_QUANTITY"
294294
]
295295

296+
TRANSPORT_COLNAMES = [
297+
"DECLARANT_ISO",
298+
"PARTNER_ISO",
299+
"PRODUCT_NSTR",
300+
"FLOW",
301+
"TRANSPORT_MODE",
302+
"CONTAINER",
303+
"PERIOD",
304+
"VALUE_IN_EUROS",
305+
"VALUE_NAC",
306+
"QUANTITY_IN_KG"
307+
]
308+
296309
DB_COLUMN_TYPE = {
297310
'comext_imp': {
298311
'DECLARANT_ISO': str,

0 commit comments

Comments
 (0)