Skip to content

Commit

Permalink
Agrego split_path_recursively
Browse files Browse the repository at this point in the history
  • Loading branch information
joangq committed May 30, 2024
1 parent 16bddf6 commit dde330d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 222 deletions.
96 changes: 26 additions & 70 deletions data_transformers/consumer/test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
"metadata": {},
"outputs": [],
"source": [
"from fundar.structures import List as Lista\n",
"from fundar.utils import snd, load_from_str_or_buf, has, access, identity, is_empty\n",
"from fundar.structures import List as Lista, slicer\n",
"from fundar.utils import snd, load_from_str_or_buf, has, access, identity, is_empty, find_file\n",
"from fundar import json\n",
"from utils import find_file, slicer\n",
"from data_transformers import transformer\n",
"from data_transformers import chain\n",
"from pandas import DataFrame\n",
Expand All @@ -25,18 +24,26 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"file = find_file('mappings.json', '../../../')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"mappings = find_file('mappings.json')\n",
"transformers = glob('./datasets_update/definitivos/transformers/*.py')\n",
"transformers = Lista(transformers)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -55,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -68,7 +75,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -104,7 +111,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -125,47 +132,25 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function __main__.rename_cols(df: pandas.core.frame.DataFrame, map)>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"transformer_from_source(f_definitions[0])"
]
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<function __main__.drop_col(df: pandas.core.frame.DataFrame, col, axis=1)>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"transformer_from_source(f_definitions[1])"
]
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -174,7 +159,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -183,7 +168,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -192,38 +177,9 @@
},
{
"cell_type": "code",
"execution_count": 38,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"([(<transformer 'start'>,\n",
" {},\n",
" sector\n",
" 0 a),\n",
" (<transformer 'rename_cols'>,\n",
" {'map': {'subsector': 'indicador', 'valor_en_mtco2e': 'valor'},\n",
" 'df': sector\n",
" 0 a},\n",
" sector\n",
" 0 a),\n",
" (<transformer 'drop_col'>,\n",
" {'col': 'sector', 'axis': 1, 'df': sector\n",
" 0 a},\n",
" Empty DataFrame\n",
" Columns: []\n",
" Index: [0])],\n",
" Empty DataFrame\n",
" Columns: []\n",
" Index: [0])"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"pipeline(df)"
]
Expand All @@ -245,7 +201,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.6"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
152 changes: 0 additions & 152 deletions data_transformers/consumer/utils.py

This file was deleted.

0 comments on commit dde330d

Please sign in to comment.