Skip to content

Conversation

@chanshing
Copy link
Member

Add --csv-time-format CLI option

Add CLI option to specify the datetime format for parsing the time column in CSV files.

Usage

# Specify time column format
stepcount data.csv --csv-time-format '%Y-%m-%d %H:%M:%S.%f'

# European date format
stepcount data.csv --csv-time-format '%d/%m/%Y %H:%M:%S'

Files Changed

src/stepcount/stepcount.py

  • Add --csv-time-format argument for strptime format string
  • Pass parameter to utils.read()

src/stepcount/utils.py

  • Add csv_time_format parameter to read()
  • When specified, parse time column using pd.to_datetime() with explicit format
  • When None, use pandas auto-detection (existing behavior)
  • Update warning for non-CSV files to include new option

**src/stepcount/stepcount.py**
- Add --csv-time-format arg for specifying strptime format string

**src/stepcount/utils.py**
- Add csv_time_format param to read()
- When specified, parse time column using pd.to_datetime() with explicit format
- When None, use pandas auto-detection (existing behavior)
- Update warning for non-CSV files
@chanshing chanshing merged commit 12e7649 into main Dec 10, 2025
9 checks passed
@chanshing chanshing deleted the feat/csv-time-format branch December 10, 2025 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants