1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to stop python auto date parsing while reading a excel file

Discussão em 'Python' iniciado por Stack, Setembro 13, 2024.

  1. Stack

    Stack Membro Participativo

    i need to read a excel file without changing any date , time format , float format and convert to data-frame. This is working fine if i convert the excel to CSV and read it using read_csv() .

    eg:

    import pandas as pd
    import numpy as np
    #code for reading excel
    df=pd.read_excel("605.xlsx",parse_dates=False,sheet_name="Group 1",keep_default_na=False,dtype=str)
    print("df_excel:")
    #code for reading csv

    df1=pd.read_csv("Group 1.csv",parse_dates=False,dtype=str,na_filter = False)
    print("df_csv:",df1)


    output: [​IMG]

    in the above code parse_dates=False is working fine while reading CSV file, but parse_dates=False is not working in read_excel()

    Expected output: Need the exact excel data into a data-frame without changing the date , time format.

    Continue reading...

Compartilhe esta Página