generated from user_client2024/154
System save at 26/05/2025 11:28 by user_client2024
This commit is contained in:
parent
f46e824544
commit
e7a5cbaaf5
@ -94,8 +94,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 41,
|
||||||
"id": "69d6771d-be1c-4ae1-802a-3ba7b2e8c5fb",
|
"id": "87cf157c-3725-4d90-bfb6-91cba5028826",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@ -103,6 +103,35 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import pandas as pd\n",
|
"import pandas as pd\n",
|
||||||
"import numpy as np\n",
|
"import numpy as np\n",
|
||||||
|
"from tms_data_interface import SQLQueryInterface"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 42,
|
||||||
|
"id": "b68368ea-9cbb-4060-b138-d8b7c3d8a193",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"query2 = \"\"\"\n",
|
||||||
|
" SELECT *\n",
|
||||||
|
"\n",
|
||||||
|
" FROM percentile_dist\n",
|
||||||
|
"\"\"\""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 43,
|
||||||
|
"id": "69d6771d-be1c-4ae1-802a-3ba7b2e8c5fb",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
"query = \"\"\"\n",
|
"query = \"\"\"\n",
|
||||||
" SELECT \n",
|
" SELECT \n",
|
||||||
" t.transaction_key,\n",
|
" t.transaction_key,\n",
|
||||||
@ -151,7 +180,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 44,
|
||||||
"id": "82c2152f-513c-4fde-a4a9-6ee3a01ef897",
|
"id": "82c2152f-513c-4fde-a4a9-6ee3a01ef897",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -215,15 +244,42 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 45,
|
||||||
|
"id": "fdefde12-97ab-4545-9612-153f707b7bc9",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"seq = SQLQueryInterface(schema=\"transactionschema\")\n",
|
||||||
|
"data = seq.execute_raw(query2)\n",
|
||||||
|
"Columns = ['point_of_percentile', 'value', 'total_event',\n",
|
||||||
|
" 'true_positive', 'false_positive', 'tpsar']\n",
|
||||||
|
"percent_dist = pd.DataFrame(data,columns = Columns)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 52,
|
||||||
|
"id": "8cc4b541-75a6-4fa7-978a-12df50f94d32",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# round(int(percent_dist[percent_dist['point_of_percentile']\\\n",
|
||||||
|
"# == 75]['value'].iloc[0])/100)*100"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 53,
|
||||||
"id": "b6c85de2-6a47-4109-8885-c138c289ec25",
|
"id": "b6c85de2-6a47-4109-8885-c138c289ec25",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"\n",
|
|
||||||
"from tms_data_interface import SQLQueryInterface\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"class Scenario:\n",
|
"class Scenario:\n",
|
||||||
" seq = SQLQueryInterface(schema=\"transactionschema\")\n",
|
" seq = SQLQueryInterface(schema=\"transactionschema\")\n",
|
||||||
@ -252,7 +308,8 @@
|
|||||||
" ]\n",
|
" ]\n",
|
||||||
" df = pd.DataFrame(row_list, columns = cols)\n",
|
" df = pd.DataFrame(row_list, columns = cols)\n",
|
||||||
" df['Segment'] = 'SME'\n",
|
" df['Segment'] = 'SME'\n",
|
||||||
" df['MIN_LIMIT'] = 50000\n",
|
" df['MIN_LIMIT'] = round(int(percent_dist[percent_dist['point_of_percentile']\\\n",
|
||||||
|
" == 75]['value'].iloc[0])/100)*100\n",
|
||||||
" df['PCT_RANGE'] = 20\n",
|
" df['PCT_RANGE'] = 20\n",
|
||||||
" \n",
|
" \n",
|
||||||
" scenario_data = scenario9_data(df)\n",
|
" scenario_data = scenario9_data(df)\n",
|
||||||
@ -262,7 +319,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 55,
|
||||||
"id": "1f20337b-8116-47e5-8743-1ba41e2df819",
|
"id": "1f20337b-8116-47e5-8743-1ba41e2df819",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
|
|||||||
73
main.ipynb
73
main.ipynb
@ -94,8 +94,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 1,
|
"execution_count": 41,
|
||||||
"id": "69d6771d-be1c-4ae1-802a-3ba7b2e8c5fb",
|
"id": "87cf157c-3725-4d90-bfb6-91cba5028826",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
@ -103,6 +103,35 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"import pandas as pd\n",
|
"import pandas as pd\n",
|
||||||
"import numpy as np\n",
|
"import numpy as np\n",
|
||||||
|
"from tms_data_interface import SQLQueryInterface"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 42,
|
||||||
|
"id": "b68368ea-9cbb-4060-b138-d8b7c3d8a193",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"query2 = \"\"\"\n",
|
||||||
|
" SELECT *\n",
|
||||||
|
"\n",
|
||||||
|
" FROM percentile_dist\n",
|
||||||
|
"\"\"\""
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 43,
|
||||||
|
"id": "69d6771d-be1c-4ae1-802a-3ba7b2e8c5fb",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"\n",
|
||||||
"query = \"\"\"\n",
|
"query = \"\"\"\n",
|
||||||
" SELECT \n",
|
" SELECT \n",
|
||||||
" t.transaction_key,\n",
|
" t.transaction_key,\n",
|
||||||
@ -151,7 +180,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 3,
|
"execution_count": 44,
|
||||||
"id": "82c2152f-513c-4fde-a4a9-6ee3a01ef897",
|
"id": "82c2152f-513c-4fde-a4a9-6ee3a01ef897",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
@ -215,15 +244,42 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": 4,
|
"execution_count": 45,
|
||||||
|
"id": "fdefde12-97ab-4545-9612-153f707b7bc9",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"seq = SQLQueryInterface(schema=\"transactionschema\")\n",
|
||||||
|
"data = seq.execute_raw(query2)\n",
|
||||||
|
"Columns = ['point_of_percentile', 'value', 'total_event',\n",
|
||||||
|
" 'true_positive', 'false_positive', 'tpsar']\n",
|
||||||
|
"percent_dist = pd.DataFrame(data,columns = Columns)"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 52,
|
||||||
|
"id": "8cc4b541-75a6-4fa7-978a-12df50f94d32",
|
||||||
|
"metadata": {
|
||||||
|
"tags": []
|
||||||
|
},
|
||||||
|
"outputs": [],
|
||||||
|
"source": [
|
||||||
|
"# round(int(percent_dist[percent_dist['point_of_percentile']\\\n",
|
||||||
|
"# == 75]['value'].iloc[0])/100)*100"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cell_type": "code",
|
||||||
|
"execution_count": 53,
|
||||||
"id": "b6c85de2-6a47-4109-8885-c138c289ec25",
|
"id": "b6c85de2-6a47-4109-8885-c138c289ec25",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
},
|
},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"\n",
|
|
||||||
"from tms_data_interface import SQLQueryInterface\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"class Scenario:\n",
|
"class Scenario:\n",
|
||||||
" seq = SQLQueryInterface(schema=\"transactionschema\")\n",
|
" seq = SQLQueryInterface(schema=\"transactionschema\")\n",
|
||||||
@ -252,7 +308,8 @@
|
|||||||
" ]\n",
|
" ]\n",
|
||||||
" df = pd.DataFrame(row_list, columns = cols)\n",
|
" df = pd.DataFrame(row_list, columns = cols)\n",
|
||||||
" df['Segment'] = 'SME'\n",
|
" df['Segment'] = 'SME'\n",
|
||||||
" df['MIN_LIMIT'] = 50000\n",
|
" df['MIN_LIMIT'] = round(int(percent_dist[percent_dist['point_of_percentile']\\\n",
|
||||||
|
" == 75]['value'].iloc[0])/100)*100\n",
|
||||||
" df['PCT_RANGE'] = 20\n",
|
" df['PCT_RANGE'] = 20\n",
|
||||||
" \n",
|
" \n",
|
||||||
" scenario_data = scenario9_data(df)\n",
|
" scenario_data = scenario9_data(df)\n",
|
||||||
@ -262,7 +319,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "code",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": 55,
|
||||||
"id": "1f20337b-8116-47e5-8743-1ba41e2df819",
|
"id": "1f20337b-8116-47e5-8743-1ba41e2df819",
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"tags": []
|
"tags": []
|
||||||
|
|||||||
44
main.py
44
main.py
@ -87,11 +87,27 @@
|
|||||||
# return df
|
# return df
|
||||||
|
|
||||||
|
|
||||||
# In[1]:
|
# In[41]:
|
||||||
|
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
from tms_data_interface import SQLQueryInterface
|
||||||
|
|
||||||
|
|
||||||
|
# In[42]:
|
||||||
|
|
||||||
|
|
||||||
|
query2 = """
|
||||||
|
SELECT *
|
||||||
|
|
||||||
|
FROM percentile_dist
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
# In[43]:
|
||||||
|
|
||||||
|
|
||||||
query = """
|
query = """
|
||||||
SELECT
|
SELECT
|
||||||
t.transaction_key,
|
t.transaction_key,
|
||||||
@ -138,7 +154,7 @@ query = """
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# In[3]:
|
# In[44]:
|
||||||
|
|
||||||
|
|
||||||
def trx_count_sum_groupwise(data_filt_partywise):
|
def trx_count_sum_groupwise(data_filt_partywise):
|
||||||
@ -196,10 +212,25 @@ def scenario9_data(data1):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# In[4]:
|
# In[45]:
|
||||||
|
|
||||||
|
|
||||||
from tms_data_interface import SQLQueryInterface
|
seq = SQLQueryInterface(schema="transactionschema")
|
||||||
|
data = seq.execute_raw(query2)
|
||||||
|
Columns = ['point_of_percentile', 'value', 'total_event',
|
||||||
|
'true_positive', 'false_positive', 'tpsar']
|
||||||
|
percent_dist = pd.DataFrame(data,columns = Columns)
|
||||||
|
|
||||||
|
|
||||||
|
# In[52]:
|
||||||
|
|
||||||
|
|
||||||
|
# round(int(percent_dist[percent_dist['point_of_percentile']\
|
||||||
|
# == 75]['value'].iloc[0])/100)*100
|
||||||
|
|
||||||
|
|
||||||
|
# In[53]:
|
||||||
|
|
||||||
|
|
||||||
class Scenario:
|
class Scenario:
|
||||||
seq = SQLQueryInterface(schema="transactionschema")
|
seq = SQLQueryInterface(schema="transactionschema")
|
||||||
@ -228,7 +259,8 @@ class Scenario:
|
|||||||
]
|
]
|
||||||
df = pd.DataFrame(row_list, columns = cols)
|
df = pd.DataFrame(row_list, columns = cols)
|
||||||
df['Segment'] = 'SME'
|
df['Segment'] = 'SME'
|
||||||
df['MIN_LIMIT'] = 50000
|
df['MIN_LIMIT'] = round(int(percent_dist[percent_dist['point_of_percentile']\
|
||||||
|
== 75]['value'].iloc[0])/100)*100
|
||||||
df['PCT_RANGE'] = 20
|
df['PCT_RANGE'] = 20
|
||||||
|
|
||||||
scenario_data = scenario9_data(df)
|
scenario_data = scenario9_data(df)
|
||||||
@ -236,7 +268,7 @@ class Scenario:
|
|||||||
return scenario_data
|
return scenario_data
|
||||||
|
|
||||||
|
|
||||||
# In[ ]:
|
# In[55]:
|
||||||
|
|
||||||
|
|
||||||
# sen = Scenario()
|
# sen = Scenario()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user