This is what my data looks like:
'''
Symbol Amount <br />
BB 1000 <br />
TIS 8574 <br />
LIG 1333 <br />
etc... etc... <br />
etc...
'''
Since the first column is strings and the second is integers, how do I get the code to skip over the first column and only add the second?
This is what I have:
def total_shares(port_list):
column_sum = 0
for x in port_list:
column_sum = sum(x[1])
return column_sum
port_list contains a list of tuples. I took that list and made it into two columns, now I was to add everything in the amount column only.
my existing code gives me this error -
column_sum = sum(x[1]) TypeError: 'int' object is not iterable
the def total_shares(port_list): is apart of the code but it won't show as it, I'm not sure why
question from:
https://stackoverflow.com/questions/65948111/i-want-to-bypass-the-headers-and-have-just-the-sum-of-the-amount-column-how-do 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…