AttributeError: 'DataFrame' object has no attribute 'Close'

Hi. As a newbie in Python, i dont understand what this error message means, because code has no “close” term… how do I fix the code in order for the graph to display? Thank you.

(Please see attached.)

def make_graph(stock_data, revenue_data, stock):
fig = make_subplots(rows=2, cols=1, shared_xaxes=True, subplot_titles=(“Historical Share Price”, “Historical Revenue”), vertical_spacing = .3)
fig.add_trace(go.Scatter(x=pd.to_datetime(stock_data.Date, infer_datetime_format=True), y=stock_data.Close.astype(“float”), name=“Share Price”), row=1, col=1)
fig.add_trace(go.Scatter(x=pd.to_datetime(revenue_data.Date, infer_datetime_format=True), y=revenue_data.Revenue.astype(“float”), name=“Revenue”), row=2, col=1)
fig.update_xaxes(title_text=“Date”, row=1, col=1)
fig.update_xaxes(title_text=“Date”, row=2, col=1)
fig.update_yaxes(title_text=“Price ($US)”, row=1, col=1)
fig.update_yaxes(title_text=“Revenue ($US Millions)”, row=2, col=1)
fig.update_layout(showlegend=False,
height=900,
title=stock,
xaxis_rangeslider_visible=True)
fig.show()

Hi Moon,

I see the “Close”…

Cheers, Dominik

yes. have seen that… when i went back to the coder’s previous codes…so i added that part to the paragraph. but i dont know which part is erroneous?

Try out what happens if you delete said Close and the belonging point… So that the belonging part looks like stock_data.astype(“float”).