Skip to content

daviscabral/fill_with_zero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Fill with zero

Given an ordered list of inputs, fill the gap records with zero.

Example:

    data = [{
        "date": "2000-10-31T01:30:00.000-05:00",
        "value": 1,
    }]
    fill_with_zeros(data, datetime(2000, 10, 20), datetime(2000, 10, 31))

Expected result would be:

    [
      {'date': '2000-10-31T01:30:00.000-05:00', 'value': 1},
      {'date': '2000-10-30T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-29T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-28T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-27T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-26T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-25T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-24T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-23T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-22T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-21T00:00:00-05:00', 'value': 0},
      {'date': '2000-10-20T00:00:00-05:00', 'value': 0}
    ]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages