The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

Python code in Jupyter

jabrjabr Member Posts: 6 Learner II
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: 541 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 Learner II
    @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: 541 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.