up vote0down votefavorite Following is my code: the output is: [[\'Date\', \'1 m
ID: 3750386 • Letter: U
Question
up vote0down votefavorite
Following is my code:
the output is:
[['Date', '1 mo', '3 mo', '6 mo', '1 yr', '2 yr', '3 yr', '5 yr', '7 yr', '10 yr', '20 yr', '30 yr'], ['01/02/18', '1.29', '1.44', '1.61', '1.83', '1.92', '2.01', '2.25', '2.38', '2.46', '2.64', '2.81'], ['01/03/18', '1.29', '1.41', '1.59', '1.81', '1.94', '2.02', '2.25', '2.37', '2.44', '2.62', '2.78'], ['01/04/18', '1.28', '1.41', '1.60', '1.82', '1.96', '2.05', '2.27', '2.38', '2.46', '2.62', '2.79'],.....]
However, I want to make the output looks like this:
['Date', '1 mo', '3 mo', '6 mo', '1 yr', '2 yr', '3 yr', '5 yr', '7 yr', '10 yr', '20 yr', '30 yr']
Following that should be a list for each data row. Convert each interest rate value from a string to a float:
['01/02/18', 1.29, 1.44, 1.61, 1.83, 1.92, 2.01, 2.25, 2.38, 2.46, 2.64, 2.81] ... ['09/14/18', 2.02, 2.16, 2.33, 2.56, 2.78, 2.85, 2.90, 2.96, 2.99, 3.07, 3.13]
Please help me how to change it
Explanation / Answer
In the last Statement,
print(daily_yeilds_curves)
Just update it like this :
print("daily_yeilds_curves = [ ")
for x in daily_yeilds_curves:
print(" ",x,", ")
print("]")
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.