[Python] Additional decimal dots observed after writing the data through ExcelWriter

Discussão em 'Python' iniciado por Stack, Junho 10, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to copy the data in data.csv from A1 to T1 and append this data in Merged data.xlsx in cells from D2 to W2. With below Code i am able to write the data in the specific cells .

    import pandas as pd
    import numpy as np
    import os

    df=pd.read_csv('data.csv', header=0)
    with pd.ExcelWriter('Mergeddata.xlsx', engine="openpyxl", mode='a', if_sheet_exists='overlay') as writer:
    df.to_excel(writer, sheet_name='Sheet1',startcol=3,startrow=1,index=False)


    Data.csv(Initial content)enter image description here data that needs to copy:

    90.77 90.7 90.8 81 69.3 90 0.72 0.71 0.72 64.46 90 64.54 63.64 65 5808.68 90 0.98 0.98 0.98 88.24 90

    Initial data(MergeData.xlsx) :

    Time NE Index DuVoltageAvg(V) DuVoltageMin(V) DuVoltageMax(V) DuVoltageTot(V) DuVoltageCnt(count) DuCurrentAvg(A) DuCurrentMin(A) DuCurrentMax(A) DuCurrentTot(A) DuCurrentCnt(count) DuPowerAvg(W) DuPowerMin(W) DuPowerMax(W) DuPowerTot(W) DuPowerCnt(count) PowerFactorAvg(PF) PowerFactorMin(PF) PowerFactorMax(PF) PowerFactorTot(PF) PowerFactorCnt(count)

    2025-06-08 15:15 SC_401B ShelfID0/SlotID0 90.73 90.6 90.8 8165.7 90 0.72 0.71 0.72 64.44 90 64.46 63.64 65.45 5801.3 90 0.98 0.98 0.98 88.24 90

    Data After Excelwriter(MergeData.xlsx):

    enter image description here

    90.77 90.7 90.8 8169.3 90.0 0.72 0.71 0.72.1 64.46 90.0.1 64.54 63.64 65.0 5808.68 90.0.2 0.98 0.98.1 0.98.2 88.24 90.0.3

    After the excelwriter ,somehow 2 additional decimal dots started coming in the cell values .Need help with this issue

    Continue reading...

Compartilhe esta Página