Can not convert QuantBook().History to Panda DataFrame

Hi there, i tried to run the following code

from clr import AddReference
from System import *
from QuantConnect import *
from QuantConnect.Data.Market import TradeBar, QuoteBar
from QuantConnect.Jupyter import *
from QuantConnect.Indicators import *
from datetime import datetime, timedelta
import matplotlib.pyplot as plt
import pandas as pd

import matplotlib.pyplot as plt
import as cm
import numpy as np
import pandas as pd
import statsmodels.api as sm
from math import floor'seaborn-whitegrid')
from sklearn import linear_model

# Create an instance
qb = QuantBook()

syls = ["XOM","CVX"]

x = qb.History(syls[0], 100, Resolution.Daily).loc[syls[0]]['close']
y = qb.History(syls[1], 100, Resolution.Daily).loc[syls[1]]['close']

and i got the following error

5 x = qb.History(syls[0], 100, Resolution.Daily).loc[syls[0]]['close']
6 y = qb.History(syls[1], 100, Resolution.Daily).loc[syls[1]]['close']

AttributeError: '1, Culture=neutral, PublicKeyToken=null]]' object has no attribute 'loc'

i also tried the solutions given in nothing worked for me.Thank you very much for your answers
Update Backtest

Update Backtest


The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


This discussion is closed