Python- dictionary with list of list elementsHow to merge two dictionaries in a single expression?Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonDoes Python have a ternary conditional operator?How do I sort a dictionary by value?Getting the last element of a list in PythonHow do I get the number of elements in a list in Python?How do I list all files of a directory?
Is there a RAID 0 Equivalent for RAM?
How should I respond when I lied about my education and the company finds out through background check?
Does the UK parliament need to pass secondary legislation to accept the Article 50 extension
Is this toilet slogan correct usage of the English language?
Temporarily disable WLAN internet access for children, but allow it for adults
Calculate sum of polynomial roots
Can disgust be a key component of horror?
What is going on with 'gets(stdin)' on the site coderbyte?
Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?
Why is the "ls" command showing permissions of files in a FAT32 partition?
How to explain what's wrong with this application of the chain rule?
How do apertures which seem too large to physically fit work?
What should you do if you miss a job interview (deliberately)?
Unexpected behavior of the procedure `Area` on the object 'Polygon'
creating a ":KeepCursor" command
How does a computer interpret real numbers?
Fear of getting stuck on one programming language / technology that is not used in my country
How to cover method return statement in Apex Class?
Are Captain Marvel's powers affected by Thanos' actions in Infinity War
Calculating total slots
Pre-mixing cryogenic fuels and using only one fuel tank
Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?
Can a stoichiometric mixture of oxygen and methane exist as a liquid at standard pressure and some (low) temperature?
Mixing PEX brands
Python- dictionary with list of list elements
How to merge two dictionaries in a single expression?Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonDifference between append vs. extend list methods in PythonDoes Python have a ternary conditional operator?How do I sort a dictionary by value?Getting the last element of a list in PythonHow do I get the number of elements in a list in Python?How do I list all files of a directory?
Edit: Sorry - I am very inexperienced at basically all of this. I will try again.
It appears that my dictionaries are messed up somehow because when I call the function, most of the results are nan
Please let me know if you need anything in addition to the below, I barely know how to write code and I certainly don't know how to fix other peoples code so just let me know what other info you may need.
N_SAMPLES = 10000
IEA_LV = fin_data['Yield_IEA'][0]
IEA_STD = fin_data['Yield_IEA'].std()
IBL_LV = fin_data['Cost_IBL'][0]
IBL_STD = fin_data['Cost_IBL'].std()
# Proxy for Default Rate- See Notes
fin_data['NPL'] = fin_data['NPL_to_Loan']*fin_data['Total_Loans']
NPL_LV = fin_data['NPL'][0]
# default rate info (based on past due loans)
default_mean = fin_data['Default_Rate'].mean()
default_std = fin_data['Default_Rate'].std()
LGD = fin_data['LGD'][0]
prior_LGD = fin_data['LGD'][1]
fin_data['non_int_exp_toAssets'] = fin_data['Non_Int_Exp']/fin_data['Total_Loans']
# non-interest expense info
nonint_exp_LV = fin_data['non_int_exp_toAssets'][0]
nonint_exp_STD = fin_data['non_int_exp_toAssets'].std()
#deposit info
dep_LV = fin_data['Deposits'][0]
dep_STD = fin_data['Deposits'].std()
dep_min = fin_data['Deposits'].min()
# Loan growth information
fin_data['loan_g'] = fin_data['Total_Loans']/fin_data['Total_Loans'].shift(-1) - 1
loan_g_min = fin_data['loan_g'].min()
loan_g_avg = fin_data['loan_g'].mean()
loan_g_std = fin_data['loan_g'].std()
w_minus_r = fin_data['Net_Chg_Off'].mean()
def_credit_flow = default_mean*fin_data['Total_Loans'][0]
# Projected NPLs
next_NPL = NPL_LV + def_credit_flow + NPL_LV * (1 - w_minus_r)
#Net adjustment for impaired loans needs LGD updated
adj_imp_loans = def_credit_flow * LGD + NPL_LV * (1-w_minus_r) * (LGD - prior_LGD)
# Reserve for Loan Loss
ALLL = fin_data['ALLL'][0] * fin_data['Total_Loans'][0] + adj_imp_loans - NPL_LV * w_minus_r
# variable: [most recent value or average, standard deviation]
var_stats_dict = 'IEA': [IEA_LV, IEA_STD], 'IBL': [IBL_LV, IBL_STD], 'Default Rate': [default_mean, default_std],
'Non Int Exp': [nonint_exp_LV, nonint_exp_STD],
'GPL': [loan_g_avg, loan_g_std], 'Deposits': [dep_LV, dep_STD]
# var: [[min, max for severe], [min, max for moderate], [min, max for low]]
# severe = 0, moderate = 1, low = 2
severity_dict = 'IEA': [[IEA_LV - 3 * IEA_STD, IEA_LV + 1 * IEA_STD],
[IEA_LV - 2 * IEA_STD, IEA_LV + 2 * IEA_STD],
[IEA_LV - 1 * IEA_STD, IEA_LV + 3 * IEA_STD]],
'IBL': [[IBL_LV - 1 * IBL_STD, IBL_LV + 3 * IBL_STD],
[IBL_LV - 2 * IBL_STD, IBL_LV + 2 * IBL_STD],
[IBL_LV - 3 * IBL_STD, IBL_LV + 1 * IBL_STD]],
'Default Rate': [[default_mean - 1 * default_std,
default_mean + 3 * default_std],
[default_mean - 2 * default_std,
default_mean + 2 * default_std],
[default_mean - 3 * default_std,
default_mean + 1 * default_std]],
'Non Int Exp': [nonint_exp_LV - 1 * nonint_exp_STD,
nonint_exp_LV + 1 * nonint_exp_STD],
'GPL': [[loan_g_min, loan_g_avg],
[loan_g_avg - 1 * loan_g_std, loan_g_avg + 1 * loan_g_std],
[loan_g_avg, loan_g_avg + 2 * loan_g_std]],
'Deposits': [[dep_min, dep_LV],
[dep_LV - 1 * dep_STD, dep_LV + 1 * dep_STD],
[dep_LV, dep_LV + 2 * dep_STD]]
#vars = IEA, IBL, Default Rate, Non Int Exp, GPL, Deposits
def mc_generator(var, severity):
low_cap = severity_dict[var][severity][0]
up_cap = severity_dict[var][severity][1]
mu = var_stats_dict[var][0]
sigma = var_stats_dict[var][1]
container = []
for i in range(0, N_SAMPLES):
x = np.random.normal(loc = mu, scale = sigma)
result = stats.beta.pdf(x, low_cap, up_cap)
container.append(result)
avg_val = sum(container)/N_SAMPLES
return round(avg_val, 10)
print(mc_generator('Non Int Exp', 0))
python
add a comment |
Edit: Sorry - I am very inexperienced at basically all of this. I will try again.
It appears that my dictionaries are messed up somehow because when I call the function, most of the results are nan
Please let me know if you need anything in addition to the below, I barely know how to write code and I certainly don't know how to fix other peoples code so just let me know what other info you may need.
N_SAMPLES = 10000
IEA_LV = fin_data['Yield_IEA'][0]
IEA_STD = fin_data['Yield_IEA'].std()
IBL_LV = fin_data['Cost_IBL'][0]
IBL_STD = fin_data['Cost_IBL'].std()
# Proxy for Default Rate- See Notes
fin_data['NPL'] = fin_data['NPL_to_Loan']*fin_data['Total_Loans']
NPL_LV = fin_data['NPL'][0]
# default rate info (based on past due loans)
default_mean = fin_data['Default_Rate'].mean()
default_std = fin_data['Default_Rate'].std()
LGD = fin_data['LGD'][0]
prior_LGD = fin_data['LGD'][1]
fin_data['non_int_exp_toAssets'] = fin_data['Non_Int_Exp']/fin_data['Total_Loans']
# non-interest expense info
nonint_exp_LV = fin_data['non_int_exp_toAssets'][0]
nonint_exp_STD = fin_data['non_int_exp_toAssets'].std()
#deposit info
dep_LV = fin_data['Deposits'][0]
dep_STD = fin_data['Deposits'].std()
dep_min = fin_data['Deposits'].min()
# Loan growth information
fin_data['loan_g'] = fin_data['Total_Loans']/fin_data['Total_Loans'].shift(-1) - 1
loan_g_min = fin_data['loan_g'].min()
loan_g_avg = fin_data['loan_g'].mean()
loan_g_std = fin_data['loan_g'].std()
w_minus_r = fin_data['Net_Chg_Off'].mean()
def_credit_flow = default_mean*fin_data['Total_Loans'][0]
# Projected NPLs
next_NPL = NPL_LV + def_credit_flow + NPL_LV * (1 - w_minus_r)
#Net adjustment for impaired loans needs LGD updated
adj_imp_loans = def_credit_flow * LGD + NPL_LV * (1-w_minus_r) * (LGD - prior_LGD)
# Reserve for Loan Loss
ALLL = fin_data['ALLL'][0] * fin_data['Total_Loans'][0] + adj_imp_loans - NPL_LV * w_minus_r
# variable: [most recent value or average, standard deviation]
var_stats_dict = 'IEA': [IEA_LV, IEA_STD], 'IBL': [IBL_LV, IBL_STD], 'Default Rate': [default_mean, default_std],
'Non Int Exp': [nonint_exp_LV, nonint_exp_STD],
'GPL': [loan_g_avg, loan_g_std], 'Deposits': [dep_LV, dep_STD]
# var: [[min, max for severe], [min, max for moderate], [min, max for low]]
# severe = 0, moderate = 1, low = 2
severity_dict = 'IEA': [[IEA_LV - 3 * IEA_STD, IEA_LV + 1 * IEA_STD],
[IEA_LV - 2 * IEA_STD, IEA_LV + 2 * IEA_STD],
[IEA_LV - 1 * IEA_STD, IEA_LV + 3 * IEA_STD]],
'IBL': [[IBL_LV - 1 * IBL_STD, IBL_LV + 3 * IBL_STD],
[IBL_LV - 2 * IBL_STD, IBL_LV + 2 * IBL_STD],
[IBL_LV - 3 * IBL_STD, IBL_LV + 1 * IBL_STD]],
'Default Rate': [[default_mean - 1 * default_std,
default_mean + 3 * default_std],
[default_mean - 2 * default_std,
default_mean + 2 * default_std],
[default_mean - 3 * default_std,
default_mean + 1 * default_std]],
'Non Int Exp': [nonint_exp_LV - 1 * nonint_exp_STD,
nonint_exp_LV + 1 * nonint_exp_STD],
'GPL': [[loan_g_min, loan_g_avg],
[loan_g_avg - 1 * loan_g_std, loan_g_avg + 1 * loan_g_std],
[loan_g_avg, loan_g_avg + 2 * loan_g_std]],
'Deposits': [[dep_min, dep_LV],
[dep_LV - 1 * dep_STD, dep_LV + 1 * dep_STD],
[dep_LV, dep_LV + 2 * dep_STD]]
#vars = IEA, IBL, Default Rate, Non Int Exp, GPL, Deposits
def mc_generator(var, severity):
low_cap = severity_dict[var][severity][0]
up_cap = severity_dict[var][severity][1]
mu = var_stats_dict[var][0]
sigma = var_stats_dict[var][1]
container = []
for i in range(0, N_SAMPLES):
x = np.random.normal(loc = mu, scale = sigma)
result = stats.beta.pdf(x, low_cap, up_cap)
container.append(result)
avg_val = sum(container)/N_SAMPLES
return round(avg_val, 10)
print(mc_generator('Non Int Exp', 0))
python
Function is returning nan Show us the calling code. All I see here is a function definition that is never actually called.
– John Gordon
Mar 8 at 1:53
1
Could you add an Minimal, Complete, and Verifiable example showing a complete minimal working version of your code? For example, are you simply callingmc_generator()? Answering your question is difficult without knowing the full context of the problem.
– Chris Larson
Mar 8 at 1:58
1
As it stands, the indentation of the first line needs to be corrected, your dictionaries are populated with variables that are not defined in your code, and we have no idea what you are doing to call your function. Without those, it's not really practical for anyone to try to answer.
– Chris Larson
Mar 8 at 2:02
add a comment |
Edit: Sorry - I am very inexperienced at basically all of this. I will try again.
It appears that my dictionaries are messed up somehow because when I call the function, most of the results are nan
Please let me know if you need anything in addition to the below, I barely know how to write code and I certainly don't know how to fix other peoples code so just let me know what other info you may need.
N_SAMPLES = 10000
IEA_LV = fin_data['Yield_IEA'][0]
IEA_STD = fin_data['Yield_IEA'].std()
IBL_LV = fin_data['Cost_IBL'][0]
IBL_STD = fin_data['Cost_IBL'].std()
# Proxy for Default Rate- See Notes
fin_data['NPL'] = fin_data['NPL_to_Loan']*fin_data['Total_Loans']
NPL_LV = fin_data['NPL'][0]
# default rate info (based on past due loans)
default_mean = fin_data['Default_Rate'].mean()
default_std = fin_data['Default_Rate'].std()
LGD = fin_data['LGD'][0]
prior_LGD = fin_data['LGD'][1]
fin_data['non_int_exp_toAssets'] = fin_data['Non_Int_Exp']/fin_data['Total_Loans']
# non-interest expense info
nonint_exp_LV = fin_data['non_int_exp_toAssets'][0]
nonint_exp_STD = fin_data['non_int_exp_toAssets'].std()
#deposit info
dep_LV = fin_data['Deposits'][0]
dep_STD = fin_data['Deposits'].std()
dep_min = fin_data['Deposits'].min()
# Loan growth information
fin_data['loan_g'] = fin_data['Total_Loans']/fin_data['Total_Loans'].shift(-1) - 1
loan_g_min = fin_data['loan_g'].min()
loan_g_avg = fin_data['loan_g'].mean()
loan_g_std = fin_data['loan_g'].std()
w_minus_r = fin_data['Net_Chg_Off'].mean()
def_credit_flow = default_mean*fin_data['Total_Loans'][0]
# Projected NPLs
next_NPL = NPL_LV + def_credit_flow + NPL_LV * (1 - w_minus_r)
#Net adjustment for impaired loans needs LGD updated
adj_imp_loans = def_credit_flow * LGD + NPL_LV * (1-w_minus_r) * (LGD - prior_LGD)
# Reserve for Loan Loss
ALLL = fin_data['ALLL'][0] * fin_data['Total_Loans'][0] + adj_imp_loans - NPL_LV * w_minus_r
# variable: [most recent value or average, standard deviation]
var_stats_dict = 'IEA': [IEA_LV, IEA_STD], 'IBL': [IBL_LV, IBL_STD], 'Default Rate': [default_mean, default_std],
'Non Int Exp': [nonint_exp_LV, nonint_exp_STD],
'GPL': [loan_g_avg, loan_g_std], 'Deposits': [dep_LV, dep_STD]
# var: [[min, max for severe], [min, max for moderate], [min, max for low]]
# severe = 0, moderate = 1, low = 2
severity_dict = 'IEA': [[IEA_LV - 3 * IEA_STD, IEA_LV + 1 * IEA_STD],
[IEA_LV - 2 * IEA_STD, IEA_LV + 2 * IEA_STD],
[IEA_LV - 1 * IEA_STD, IEA_LV + 3 * IEA_STD]],
'IBL': [[IBL_LV - 1 * IBL_STD, IBL_LV + 3 * IBL_STD],
[IBL_LV - 2 * IBL_STD, IBL_LV + 2 * IBL_STD],
[IBL_LV - 3 * IBL_STD, IBL_LV + 1 * IBL_STD]],
'Default Rate': [[default_mean - 1 * default_std,
default_mean + 3 * default_std],
[default_mean - 2 * default_std,
default_mean + 2 * default_std],
[default_mean - 3 * default_std,
default_mean + 1 * default_std]],
'Non Int Exp': [nonint_exp_LV - 1 * nonint_exp_STD,
nonint_exp_LV + 1 * nonint_exp_STD],
'GPL': [[loan_g_min, loan_g_avg],
[loan_g_avg - 1 * loan_g_std, loan_g_avg + 1 * loan_g_std],
[loan_g_avg, loan_g_avg + 2 * loan_g_std]],
'Deposits': [[dep_min, dep_LV],
[dep_LV - 1 * dep_STD, dep_LV + 1 * dep_STD],
[dep_LV, dep_LV + 2 * dep_STD]]
#vars = IEA, IBL, Default Rate, Non Int Exp, GPL, Deposits
def mc_generator(var, severity):
low_cap = severity_dict[var][severity][0]
up_cap = severity_dict[var][severity][1]
mu = var_stats_dict[var][0]
sigma = var_stats_dict[var][1]
container = []
for i in range(0, N_SAMPLES):
x = np.random.normal(loc = mu, scale = sigma)
result = stats.beta.pdf(x, low_cap, up_cap)
container.append(result)
avg_val = sum(container)/N_SAMPLES
return round(avg_val, 10)
print(mc_generator('Non Int Exp', 0))
python
Edit: Sorry - I am very inexperienced at basically all of this. I will try again.
It appears that my dictionaries are messed up somehow because when I call the function, most of the results are nan
Please let me know if you need anything in addition to the below, I barely know how to write code and I certainly don't know how to fix other peoples code so just let me know what other info you may need.
N_SAMPLES = 10000
IEA_LV = fin_data['Yield_IEA'][0]
IEA_STD = fin_data['Yield_IEA'].std()
IBL_LV = fin_data['Cost_IBL'][0]
IBL_STD = fin_data['Cost_IBL'].std()
# Proxy for Default Rate- See Notes
fin_data['NPL'] = fin_data['NPL_to_Loan']*fin_data['Total_Loans']
NPL_LV = fin_data['NPL'][0]
# default rate info (based on past due loans)
default_mean = fin_data['Default_Rate'].mean()
default_std = fin_data['Default_Rate'].std()
LGD = fin_data['LGD'][0]
prior_LGD = fin_data['LGD'][1]
fin_data['non_int_exp_toAssets'] = fin_data['Non_Int_Exp']/fin_data['Total_Loans']
# non-interest expense info
nonint_exp_LV = fin_data['non_int_exp_toAssets'][0]
nonint_exp_STD = fin_data['non_int_exp_toAssets'].std()
#deposit info
dep_LV = fin_data['Deposits'][0]
dep_STD = fin_data['Deposits'].std()
dep_min = fin_data['Deposits'].min()
# Loan growth information
fin_data['loan_g'] = fin_data['Total_Loans']/fin_data['Total_Loans'].shift(-1) - 1
loan_g_min = fin_data['loan_g'].min()
loan_g_avg = fin_data['loan_g'].mean()
loan_g_std = fin_data['loan_g'].std()
w_minus_r = fin_data['Net_Chg_Off'].mean()
def_credit_flow = default_mean*fin_data['Total_Loans'][0]
# Projected NPLs
next_NPL = NPL_LV + def_credit_flow + NPL_LV * (1 - w_minus_r)
#Net adjustment for impaired loans needs LGD updated
adj_imp_loans = def_credit_flow * LGD + NPL_LV * (1-w_minus_r) * (LGD - prior_LGD)
# Reserve for Loan Loss
ALLL = fin_data['ALLL'][0] * fin_data['Total_Loans'][0] + adj_imp_loans - NPL_LV * w_minus_r
# variable: [most recent value or average, standard deviation]
var_stats_dict = 'IEA': [IEA_LV, IEA_STD], 'IBL': [IBL_LV, IBL_STD], 'Default Rate': [default_mean, default_std],
'Non Int Exp': [nonint_exp_LV, nonint_exp_STD],
'GPL': [loan_g_avg, loan_g_std], 'Deposits': [dep_LV, dep_STD]
# var: [[min, max for severe], [min, max for moderate], [min, max for low]]
# severe = 0, moderate = 1, low = 2
severity_dict = 'IEA': [[IEA_LV - 3 * IEA_STD, IEA_LV + 1 * IEA_STD],
[IEA_LV - 2 * IEA_STD, IEA_LV + 2 * IEA_STD],
[IEA_LV - 1 * IEA_STD, IEA_LV + 3 * IEA_STD]],
'IBL': [[IBL_LV - 1 * IBL_STD, IBL_LV + 3 * IBL_STD],
[IBL_LV - 2 * IBL_STD, IBL_LV + 2 * IBL_STD],
[IBL_LV - 3 * IBL_STD, IBL_LV + 1 * IBL_STD]],
'Default Rate': [[default_mean - 1 * default_std,
default_mean + 3 * default_std],
[default_mean - 2 * default_std,
default_mean + 2 * default_std],
[default_mean - 3 * default_std,
default_mean + 1 * default_std]],
'Non Int Exp': [nonint_exp_LV - 1 * nonint_exp_STD,
nonint_exp_LV + 1 * nonint_exp_STD],
'GPL': [[loan_g_min, loan_g_avg],
[loan_g_avg - 1 * loan_g_std, loan_g_avg + 1 * loan_g_std],
[loan_g_avg, loan_g_avg + 2 * loan_g_std]],
'Deposits': [[dep_min, dep_LV],
[dep_LV - 1 * dep_STD, dep_LV + 1 * dep_STD],
[dep_LV, dep_LV + 2 * dep_STD]]
#vars = IEA, IBL, Default Rate, Non Int Exp, GPL, Deposits
def mc_generator(var, severity):
low_cap = severity_dict[var][severity][0]
up_cap = severity_dict[var][severity][1]
mu = var_stats_dict[var][0]
sigma = var_stats_dict[var][1]
container = []
for i in range(0, N_SAMPLES):
x = np.random.normal(loc = mu, scale = sigma)
result = stats.beta.pdf(x, low_cap, up_cap)
container.append(result)
avg_val = sum(container)/N_SAMPLES
return round(avg_val, 10)
print(mc_generator('Non Int Exp', 0))
python
python
edited Mar 8 at 16:51
Frank Paolantonio
asked Mar 8 at 1:46
Frank PaolantonioFrank Paolantonio
62
62
Function is returning nan Show us the calling code. All I see here is a function definition that is never actually called.
– John Gordon
Mar 8 at 1:53
1
Could you add an Minimal, Complete, and Verifiable example showing a complete minimal working version of your code? For example, are you simply callingmc_generator()? Answering your question is difficult without knowing the full context of the problem.
– Chris Larson
Mar 8 at 1:58
1
As it stands, the indentation of the first line needs to be corrected, your dictionaries are populated with variables that are not defined in your code, and we have no idea what you are doing to call your function. Without those, it's not really practical for anyone to try to answer.
– Chris Larson
Mar 8 at 2:02
add a comment |
Function is returning nan Show us the calling code. All I see here is a function definition that is never actually called.
– John Gordon
Mar 8 at 1:53
1
Could you add an Minimal, Complete, and Verifiable example showing a complete minimal working version of your code? For example, are you simply callingmc_generator()? Answering your question is difficult without knowing the full context of the problem.
– Chris Larson
Mar 8 at 1:58
1
As it stands, the indentation of the first line needs to be corrected, your dictionaries are populated with variables that are not defined in your code, and we have no idea what you are doing to call your function. Without those, it's not really practical for anyone to try to answer.
– Chris Larson
Mar 8 at 2:02
Function is returning nan Show us the calling code. All I see here is a function definition that is never actually called.
– John Gordon
Mar 8 at 1:53
Function is returning nan Show us the calling code. All I see here is a function definition that is never actually called.
– John Gordon
Mar 8 at 1:53
1
1
Could you add an Minimal, Complete, and Verifiable example showing a complete minimal working version of your code? For example, are you simply calling
mc_generator()? Answering your question is difficult without knowing the full context of the problem.– Chris Larson
Mar 8 at 1:58
Could you add an Minimal, Complete, and Verifiable example showing a complete minimal working version of your code? For example, are you simply calling
mc_generator()? Answering your question is difficult without knowing the full context of the problem.– Chris Larson
Mar 8 at 1:58
1
1
As it stands, the indentation of the first line needs to be corrected, your dictionaries are populated with variables that are not defined in your code, and we have no idea what you are doing to call your function. Without those, it's not really practical for anyone to try to answer.
– Chris Larson
Mar 8 at 2:02
As it stands, the indentation of the first line needs to be corrected, your dictionaries are populated with variables that are not defined in your code, and we have no idea what you are doing to call your function. Without those, it's not really practical for anyone to try to answer.
– Chris Larson
Mar 8 at 2:02
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055578%2fpython-dictionary-with-list-of-list-elements%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55055578%2fpython-dictionary-with-list-of-list-elements%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Function is returning nan Show us the calling code. All I see here is a function definition that is never actually called.
– John Gordon
Mar 8 at 1:53
1
Could you add an Minimal, Complete, and Verifiable example showing a complete minimal working version of your code? For example, are you simply calling
mc_generator()? Answering your question is difficult without knowing the full context of the problem.– Chris Larson
Mar 8 at 1:58
1
As it stands, the indentation of the first line needs to be corrected, your dictionaries are populated with variables that are not defined in your code, and we have no idea what you are doing to call your function. Without those, it's not really practical for anyone to try to answer.
– Chris Larson
Mar 8 at 2:02