output —DatetimeIndex('2022-01-01', '2022-01-02', '2022-01-03', '2022-01-04',
'2022-01-05', '2022-01-06', 2022-01-07', '2022-01-08', ...
'2022-01-29', '2022-01-30', '2022-01-31',
"If you want to change the time to ""2022-01-010:00"" format,
How should I fix it?
2. If you want to enter the same value every day,
What kind of code should I write?
import pandas as pd
df = pd.DataFrame({
'A': pd.date_range(start='2022-01-01', end='2022-01-31', freq='D').strftime('%Y/%-m/%-d%-H:%M',
'B': 100,
})
df.info()
print(df)
# <class'pandas.core.frame.DataFrame'>
# RangeIndex: 31 entries, 0 to 30
# Data columns (total 2 columns):
# # Column Non-Null Count Dtype
# --- ------ -------------- -----
# 0 A 31 non-null object
# 1 B 31 non-null int 64
# dtypes: int64(1), object(1)
# memory usage —624.0+bytes
#
# AB
# 0 2022/1/1 0:00 100
# 1 2022/1/2 0:00 100
# 2 2022/1/3 0:00 100
# 3 2022/1/4 0:00 100
# 4 2022/1/5 0:00 100
# 5 2022/1/6 0:00 100
# :
# :
578 Understanding How to Configure Google API Key
571 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
572 Who developed the "avformat-59.dll" that comes with FFmpeg?
910 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.