0

I want to open the csv file and reverse it while I read the code, replace the date with the consecutive numbers and leave it there.

def s(a, b):
    try:
        if a==str(userInput) and b==int(userInput):
            for line in reversed(list(open("AAPL.csv"))):
                b=[0]
                a=[]
                for bin line:
                    count=1
                    b= count
                count+=1
                a=[]
                a=['open', 'high', 'low', 'close', 'volume', 'adj_close']
                a.lower()
    except ValueError:
        pass
    return a, b

    def main():
        pass

I get this error:

Traceback (most recent call last):File "<pyshell#4>", line 1, in <module>test_date() 
TypeError: test_date() missing 2 required positional arguments: 'col' and 'day'
Patrick Haugh
  • 59,226
  • 13
  • 88
  • 96
jp hellya
  • 11
  • 1

1 Answers1

0

The error itself means that the function test_date requires 2 arguments but you either passed one or none.

You need to paste in the function code to help you further.

A tip

You can convert the positional arguments to key arguments, which basically means adding a default value to the argument at the definition of the function, that way if the function has not been passed any args, it will work with the default values.

Example Code

def greet(name="World"):
    print("Hello",name)

greet()
# Prints out "Hello World"

greet("Michael")
# Prints out "Hello Michael"
Community
  • 1
  • 1
Michael Yousrie
  • 1,132
  • 2
  • 10
  • 20