I have a list of numpy datetime64 objects, like so:
time_list_array = [[login to view URL]('2021-01-01T07:23:00.000000000'),
[login to view URL]('2021-01-01T07:25:00.000000000'),
[login to view URL]('2021-01-01T07:26:00.000000000'),
[login to view URL]('2021-01-01T07:27:00.000000000'),
[login to view URL]('2021-01-14T16:27:00.000000000')]
I want to loop through this list and modify it in a specific way.
Essentially, any time the difference between two datetime64 objects next to each other in the list is more than one minute, duplicate that datetime64 object and place it after the original one in the list.
Any time the difference between two datetime64 objects next to each other in the list is equal to a minute, move on to the next datetime64 object in the list until you come across a difference that is more than a minute. Then, take the first datetime64 object and the last datetime64 object in that range and place them next to each other.
So, my final time_list_array would look like this:
time_list_array = [[login to view URL]('2021-01-01T07:23:00.000000000'),
[login to view URL]('2021-01-01T07:23:00.000000000'),
[login to view URL]('2021-01-01T07:25:00.000000000'),
[login to view URL]('2021-01-01T07:27:00.000000000'),
[login to view URL]('2021-01-14T16:27:00.000000000'),
[login to view URL]('2021-01-14T16:27:00.000000000')]
Notice how the 1/1/21 7:23:00 datetime64 object was duplicated and added directly after the original. Then, the range from 1/1/21 7:25:00 through 1/1/21 7:27:00 in the original array was shortened to just a start time and end time. Finally, 1/14/21 at 16:27:00 was once again duplicated and added directly after the original.
This needs to be formatted in this way to be exported to a txt file and consequently used in an online software program that only accepted txt files in a very specific format.
I have tried to find the time delta of time_list_array like so:
time_list_array_delta = [login to view URL](time_list_array)
And then find the difference in minutes:
minutes = time_list_array_delta.total_seconds()/60
But keep getting an error:
AttributeError: '[login to view URL]' object has no attribute 'total_seconds'
I may be totally off base with my methods, however. Any help would be much appreciated!
Dear employer,
Hi
I can develop the Python code to organize your list of numpy datetime objects based on your requirements. I am an expert in this field. Would you please send me a message so that we can talk about it more accurately?
I am a computer programmer with more than 10 years of working experience using Python, C#, VB.Net, C++, MATLAB, FORTRAN, etc.
I can develop your required code with the highest quality and the lowest price.
Believe me one time and you will start hiring me as a long term employee.
Regards,
Abbas
Heyy I am python coder and I have experience of more than 5years.I have read your description and would like to work for you.I have already implemented many algorithms and developed many games and management systems using oop and data structures concept and I would like to work for you also
Message me so that we can start this
Regards
Hamza
I am willing to help you to fix the error and get the desired txt output till the end.
I think I have enough python experience to solve this.
** Will continue till the end