(Aug-24-2023, 12:02 AM)cormanstan Wrote: May I ask why adding the user agent was so important?
User-Agent the website may block your requests because it knows you aren't a real user,like web-scraping or a bot.
Quote:Any suggestions how I can fix the error and call the make_graph function on gme_data and gme_revenue?
A test,so like this it should work see that most set
regex=True
if using a more that singel regex pattern in replace.
import pandas as pd
data = {
'Date': ['2021/11/24', '2021/11/25', '2021/11/26', '2021/11/27'],
'Price': ['$10,389', '$10,450', '$10,520', '$10,600'],
}
df = pd.DataFrame(data)
df['Date'] = pd.to_datetime(df['Date'])
df['Price'] = df['Price'].str.replace(r'\$|,', '', regex=True).astype(int)
>>> df
Date Price
0 2021-11-24 10389
1 2021-11-25 10450
2 2021-11-26 10520
3 2021-11-27 10600
# Works is now type int32
>>> df['Price'].max()
10600
>>> df.dtypes
Date datetime64[ns]
Price int32
dtype: object