For some reason I keep getting an odd positional argument follow keyword argument in yfinance?
#imports
import pandas as pd
import yfinance as yf
from yahoofinancials import YahooFinancials
import time
from datetime import datetime
#setup
today = datetime.today().strftime('%Y-%m-%d')
#code
#date formant 'yyyy-mm-dd'
print("Please input start and end in formant", today)
time.sleep(1)
stonks_df = yf.download('AMZN',
print("Input start date:"),
start=input(),
print("Input end date:"),
end=input(),
group_by='column',
progress=True)
stonks_df.head()
print(stonks)
Does anyone know why this is happening?
The issue with your function call is that you are, as the error suggests, passing in positional argument after a keyword argument - which is what you did after you passed in the start
keyword argument.
So, in Python:
func(arg1, arg2, kwarg1='text', kwarg2=123) # this is OK
func(kwarg1='text', kwarg2=123) # this is OK
func(arg1, kwarg1='text', arg2, kwarg2=123) # this is NOT OK
I think this is what you want to do
stonks_df = yf.download('AMZN',
start=input("Input start date:"),
end=input("Input end date:"),
group_by='column',
progress=True)