Skip to content

Instantly share code, notes, and snippets.

@benjjo
Created February 8, 2021 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benjjo/1f32379c71abb1ef8233fbba859df0d3 to your computer and use it in GitHub Desktop.
Save benjjo/1f32379c71abb1ef8233fbba859df0d3 to your computer and use it in GitHub Desktop.
creates an empty df with the date range specified, indexed by date and incrementing in seconds. Writes to a csv file.
def main():
def makeEmptyDFWithDateRange(start_date='14:45:24 2021-02-02', end_date='17:05:24 2021-02-05', set_point=22):
index = pd.date_range(start_date, end=end_date, freq='S')
columns = ['Set Point']
df = pd.DataFrame(index=index, columns=columns)
df['Set Point'] = df['Set Point'].fillna(set_point)
df.index.name = 'Time date'
df.to_csv('emptyDateRange.csv')
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment