Python Forum

Full Version: Create new column in new created table
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, can anyone assist how to add new column for a new table?

Im very new in using python and this is my first cry for help.

I have 2 tables.
Table 1 contain lists of item with it's manufacturing year and it's types.
Table 2 contains rates for each manufacturing years (from 2005 to 2019) and for different types of item.

How can I create a new table where I can list all the items that match its rates in Table 2 (new column)by looking at the 2 conditions. Below is my code only for 2005. When I run the Python it return IndentationError: expected an indented block

def df(s):
#mfg year 2005
    if (s['mfg_year'] == "2005"):
    if (s['Type'] == "A"):
     
        print (123)     #this is the rate for item with type A manufactured in 2005
    elif (s['Type'] == "B"):
       
        print (0).      #this is the rate for item with type B manufactured in 2005
        else :
            return 0
it expects indented block after line #3