Python Forum
data frame excel cell calulation
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
data frame excel cell calulation
#2
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.
Reply


Messages In This Thread
data frame excel cell calulation - by buunaanaa - Jul-02-2020, 07:42 PM
RE: data frame excel cell calulation - by buunaanaa - Jul-04-2020, 06:00 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how do you style data frame that has empty rows. gsaray101 0 537 Sep-08-2023, 05:20 PM
Last Post: gsaray101
  Copy data from Excel and paste into Discord (Midjourney) Joe_Wright 4 2,071 Jun-06-2023, 05:49 PM
Last Post: rajeshgk
  Reading data from excel file –> process it >>then write to another excel output file Jennifer_Jone 0 1,116 Mar-14-2023, 07:59 PM
Last Post: Jennifer_Jone
  googletrans library to translate text language for using data frame is not running gcozba2023 0 1,237 Mar-06-2023, 09:50 AM
Last Post: gcozba2023
  How to properly format rows and columns in excel data from parsed .txt blocks jh67 7 1,890 Dec-12-2022, 08:22 PM
Last Post: jh67
  Trying to Get Arduino sensor data over to excel using Python. eh5713 1 1,725 Dec-01-2022, 01:52 PM
Last Post: deanhystad
  Appending a row of data in an MS Excel file azizrasul 3 1,198 Nov-06-2022, 05:17 PM
Last Post: azizrasul
  Deleting rows based on cell value in Excel azizrasul 11 2,677 Oct-19-2022, 02:38 AM
Last Post: azizrasul
  Moving data from one Excel to another and finding maximum profit azizrasul 7 1,481 Oct-06-2022, 06:13 PM
Last Post: azizrasul
  Load multiple Jason data in one Data Frame vijays3 6 1,560 Aug-12-2022, 05:17 PM
Last Post: vijays3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020