Skip to content

Add utility to convert XAUUSD time column format - #17

Open
holguinmora123 wants to merge 1 commit into
mainfrom
codex/modify-time-format-in-xauusd_data_10min.csv
Open

Add utility to convert XAUUSD time column format#17
holguinmora123 wants to merge 1 commit into
mainfrom
codex/modify-time-format-in-xauusd_data_10min.csv

Conversation

@holguinmora123

Copy link
Copy Markdown
Owner

Summary

  • add convert_time_format.py to strip timezone information and format times like XAUUSD_data.csv
  • document usage in README.md

Testing

  • python convert_time_format.py XAUUSD_data_10min.csv

https://chatgpt.com/codex/tasks/task_e_68c0a472c3f4832895ed4afde5c03765

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment thread convert_time_format.py
Comment on lines +23 to +26
# Parse dates and drop timezone info if present, then format like 'YYYY-MM-DD HH:MM:SS'
times = pd.to_datetime(df['time'])
times = times.dt.tz_localize(None) # Remove timezone if it exists
df['time'] = times.dt.strftime('%Y-%m-%d %H:%M:%S')

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Guard tz-localization for timezone-naive inputs

The conversion unconditionally applies times.dt.tz_localize(None). Pandas raises TypeError: Already tz-naive, use tz_localize to localize when the series has no timezone information, so the tool fails for CSVs that are already in the desired YYYY-MM-DD HH:MM:SS format. Handling naive timestamps (e.g. by using tz_convert(None) or wrapping the call in a try/except) would let the script safely normalize both timezone-aware and timezone-free files.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant