Last active
October 4, 2022 09:37
-
-
Save Theasker/88e407b35e1e4914f184e231ba320213 to your computer and use it in GitHub Desktop.
Modificación de formato de las fechas en una columna de un archivo excel en python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| # Read the file and specify which column is the date | |
| rows = pd.read_excel("excel.xlsx") | |
| print(rows["Columna1"]) | |
| # Output with dates converted to YYYY-MM-DD | |
| fecha = pd.to_datetime(rows["Columna1"]).dt.strftime("%d-%m-%y") | |
| rows["Columna1"] = fecha | |
| rows.to_excel("excel_dd_mm_yy.xlsx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment