Python code in Jupyter

jabrjabr Member Posts: 6 Contributor I
I have an excel sheet that is updating with real-time data.

Here the time is extracting as 2.0211E+13 which should be like this 20210513095417. I need to extract 2.0211E+13 and split it into each column as date and time in Python (Jupyter notebook)?

Anybody, please help.
Tagged:

Answers

  • ceaperezceaperez Member Posts: 517 Unicorn
    Hi @jabr,

    for the first part, just change de type of of column in you excel file from number to a general. 

    for the second part, be sure that you import the Date column as polynominal attribute. Then run your python script. 

    please find attached an sample process. 

    Best

     

  • jabrjabr Member Posts: 6 Contributor I
    @ceaperez Thanks for the solutions. Is it possible to send the same process as the python code. The code which can be used in the jupyter Notebook.I am doing this project in python.
  • ceaperezceaperez Member Posts: 517 Unicorn
    Hi @jabr

    Inside the process you have a python script. 

    the basic code is this:

    from datetime import datetime


    d = ["20210513095417", "20210514095417", "20210515095417"]
    l = len(d)
    for x in range(l):
    d1 = d[x]
    dt = datetime(year=int(d1[0:4]), month=int(d1[4:6]), day=int(d1[6:8]))
    d[x] = dt
    print(d)

    Best
Sign In or Register to comment.