Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!