But I think you can omit map
and use simple subtract and then convert to list
:
symb = get_history(symbol='INFY',start = start,end = end)
print ((symb.tail(3).High - symb.tail(3).Low).tolist())
Also don't use variable list
(reserved word in python) rather L
(or something else):
L = pd.read_excel(file)
L = L['SYMBOL']
Sample:
import pandas as pd
symb = pd.DataFrame({'High':[8,9,7,5,3,4],'Low':[1,2,3,1,0,1]})
print (symb)
High Low
0 8 1
1 9 2
2 7 3
3 5 1
4 3 0
5 4 1
print ((symb.tail(3).High - symb.tail(3).Low).tolist())
[4, 3, 3]
EDIT:
I try simulate problem:
list = pd.DataFrame({'SYMBOL':['sss old','dd','old']})
print (list)
SYMBOL
0 sss old
1 dd
2 old
list = list['SYMBOL']
print (list)
0 sss old
1 dd
2 old
Name: SYMBOL, dtype: object
print (type(list))
<class 'pandas.core.series.Series'>
x = [1,2,3]
#list is Series, not function
x = list(x)
print (x)
TypeError: 'Series' object is not callable
If change list
to L
, is important reopen python console, because still same error.
So this works perfectly:
df = pd.DataFrame({'SYMBOL':['sss old','dd','old']})
print (df)
SYMBOL
0 sss old
1 dd
2 old
L = df['SYMBOL']
print (L)
0 sss old
1 dd
2 old
Name: SYMBOL, dtype: object
x = [1,2,3]
x = list(x)
print (x)
[1, 2, 3]