data frame excel cell calulation - 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: data frame excel cell calulation (/thread-28048.html) |
data frame excel cell calulation - buunaanaa - Jul-02-2020 Question 1 I am having issue finding the information on operating such as how can I make cell I2 = G8 / G9 I don't know where to start, and I cannot think of the proper keyword to search for it. I want to operate on the calculation on two or more random numbers. ------ question 2 How do I add photo in the post? it only allows me to add URL for the image. won't allow me to attach one. RE: data frame excel cell calulation - buunaanaa - Jul-04-2020 Well, let me ask the question in another way. def macdfuncs(data): # here are theclose=data['Close'] code for EMA short and EMA long close=data['Close'] #EMA short sma_short = close.rolling(12).mean() temp1=close.copy() temp1.iloc[0:12] = sma_short[0:12] ema_short = temp1.ewm(span=12, adjust=False).mean()This code is not efficient. sma_short = close.rolling(12).mean() temp1=close.copy() temp1.iloc[0:12] = sma_short[0:12]I only need the 12th cell in "ema_short" column to be the average of the first 12 cells in "close" column . and 13th to end in "ema_short" to be EMA. is there a way just set the specific cell to be the average of 12 cells? Thanks. |