'Declare variables types for python function triggers invalid syntax error [closed]

I am having trouble why I am getting an invalid syntax error when I declare what my variable is inside my function. The function works when I step through it in python, but not when I try to run the program from the command line.

command line code:

python filename.py

python code:

import pandas as pd
def my_func(df:pd.DataFrame,name:str):
    print("Hello world")
def main():
    my_func(df=pd.DataFrame(),name='name')
if __name__ == "__main__":
    main()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source