-  
-   Notifications  You must be signed in to change notification settings 
- Fork 19.2k
Open
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team membersetitem-with-expansion
Description
Pandas version checks
-  I have checked that this issue has not already been reported. 
-  I have confirmed this bug exists on the latest version of pandas. 
-  I have confirmed this bug exists on the main branch of pandas. 
Reproducible Example
import pandas as pd dt = pd.to_datetime(['2024-02-24 10:00']) s = pd.Series([1],index=dt) s.loc['2024-02-24 9:57'] = None # is inserted into s print(s) s.loc['2024-02-24 10:2:30'] = None # is inserted into s print(s) s.loc['2024-02-24 10:08'] = None # is _not_ inserted into s print(s) s.loc['2024-02-24 10:08:00'] = None # is inserted into s print(s)Issue Description
When inserting timestamps into a pandas Series, beginning with the format 'yyyy-mm-dd hh:mm', they are inserted correctly, until first time switching to format 'yyyy-mm-dd hh:mm:ss'. From then on format 'yyyy-mm-dd hh:mm' is silently not inserted, ending with seconds required.
Not sure if this is intended, unexpected behaviour in my opinion.
Expected Behavior
Insert timestamps as long as their format is parsed unambiguously.
Installed Versions
 pandas 2.1.4 py311hf62ec03_0 
santhoshbethi
Metadata
Metadata
Assignees
Labels
BugIndexingRelated to indexing on series/frames, not to indexes themselvesRelated to indexing on series/frames, not to indexes themselvesNeeds TriageIssue that has not been reviewed by a pandas team memberIssue that has not been reviewed by a pandas team membersetitem-with-expansion