0

I have a csv file with 1500 stocks with model ranks. I am trying to add a column to this dataframe that is the stock price for the symbol in the first column..

import pandas as pd
import numpy as np

df = pd.read_csv('SmallScreen.csv')
df = df.drop(df.index[:16])
df = df[[0, 1, 3, 4, 5, 6, 7]]
df.dropna(how='all')

df.columns = ['symbol', 'company', 'valuation', 'cap dep', 'earnings','market','core']
df = df.set_index('symbol')

Here is where I am stuck...

df['Price'] = web.DataReader(df['symbol'], 'yahoo', '2015-11-17", '2015-11-17")['Adj Close']
df = df.sort(['core'], ascending=[True])
df.to_csv('RankSmall_1.csv')
Brian
  • 684
  • 3
  • 16
  • 31
  • Possible duplicate of [Adding new column to existing DataFrame in Python pandas](http://stackoverflow.com/questions/12555323/adding-new-column-to-existing-dataframe-in-python-pandas) – binarysubstrate Nov 18 '15 at 22:21
  • For good measure, show your data, and say not just that you are stuck, but what the specific problem / error is. – ako Nov 19 '15 at 05:15

0 Answers0