# importing columns of returns data into python from excel/csv [closed]

I'm fairly new to the quant finance space, and I was hoping to get some guidance. Say I have a csv/excel file with columns of daily returns data for various asset classes or securities (one column per asset). I want to be able to import these returns data into Python, probably as lists/arrays.

If there are many days worth of data (say 10 years worth), what's the best way to go about this, import-wise and data structure-wise? Any packages that could help?

A minor note, I was considering using dictionaries so I could still retain the date/day, whereas if I just use lists I would just index it as 1,2,3,4...n_th day.

Thanks!

## closed as off-topic by Bob Jansen♦Jun 4 '15 at 7:21

• This question does not appear to be about quantitative finance within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• I'm afraid this is a stack-overflow question. – SmallChess Jun 4 '15 at 3:14
• I'm not sure SO would take it but it has been answered (satisfactorily IMO) now anyways. So I close it as this is not a good example of the kind of questions we want. – Bob Jansen Jun 4 '15 at 7:21
• I'm voting to close this question as off-topic because "I'm afraid this is a stack-overflow question" but it has already been answered. – Bob Jansen Jun 4 '15 at 7:21

## 1 Answer

True this is a stackoverflow question but have you tried the fool around with the package Pandas? You can do in Python

import pandas as pd

data = pd.read_csv('filepath/file.csv')

That's the easiest way.