Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Does this function work to load in a csv file? import pandas as pd def load _ data ( filename ) :

Does this function work to load in a csv file?
import pandas as pd
def load_data(filename):
"""Get the data from the given csv file.
Returns: positions, spots, volatilities, rates
"""
df = pd.read_csv('pf_%s_currency_data.csv') #load data from csv file
positions = df['positions'].values #extracting data from columns
spots = df['spot exchange rate'].values
vols = df['3-month volatility (annualized)'].values
rates = df['3-month interest rate (annualized)'].values
return positions, spots, volatilities, rates

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

=+nk so that p( B(k)) Answered: 1 week ago

Answered: 1 week ago

Question

13.6 Explain how to set up aflexible benefits program.

Answered: 1 week ago

Question

13.2 Describe five government-mandated benefits.

Answered: 1 week ago