These two lines:
dfc['Time_of_Sail'] = pd.to_datetime(dfc['Time_of_Sail'])
dfc['Time_of_Sail'] = [time.time() for time in dfc['Time_of_Sail']]
Can be written as:
dfc['Time_of_Sail'] = pd.to_datetime(dfc['Time_of_Sail'],format="%H:%M:%S" ).dt.time
More Related Contents:
- How to join two dataframes for which column values are within a certain range?
- Filtering Pandas DataFrames on dates
- How to print pandas DataFrame without index
- datetime dtypes in pandas read_csv
- python pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working
- Python Pandas Group by date using datetime data
- Removing the timestamp from a datetime in pandas dataframe
- Pandas filter dataframe rows with a specific year
- Convert Pandas Series to DateTime in a DataFrame
- Truncate `TimeStamp` column to hour precision in pandas `DataFrame`
- Python pandas integer YYYYMMDD to datetime
- Group DataFrame in 5-minute intervals
- Pandas custom function to find whether it is the 1st, 2nd etc Monday, Tuesday, etc – all suggestions welcome
- What values are valid in Pandas ‘Freq’ tags?
- Python: Adding hours to pandas timestamp
- pandas extract year from datetime: df[‘year’] = df[‘date’].year is not working
- Python Pandas : pandas.to_datetime() is switching day & month when day is less than 13
- Get weekday/day-of-week for Datetime column of DataFrame
- Plot pandas dates in matplotlib
- How to identify and label similar rows in a pandas data frame
- Renaming column names in Pandas
- How can I use the apply() function for a single column?
- Pandas select rows and columns based on boolean condition
- How to flatten a hierarchical index in columns
- AttributeError: ‘DataFrame’ object has no attribute ‘ix’
- Writing large Pandas Dataframes to CSV file in chunks
- How to merge a Series and DataFrame
- Pretty print a pandas dataframe in VS Code
- Transpose the data in a column every nth rows in PANDAS
- How to upload a CSV file in FastAPI and convert it into a Pandas Dataframe?