Python Forum
Create new column in new created table - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Create new column in new created table (/thread-27507.html)



Create new column in new created table - farhana88 - Jun-09-2020

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



RE: Create new column in new created table - buran - Jun-09-2020

it expects indented block after line #3