728x90 반응형 SMALL pd.to_datetime()1 [Matplotlib] 눈금 시간 설정 눈금 시간 설정 데이터프레임에서 str 타입의 시간을 축으로 사용하기 위해 pd.to_datetime() 함수를 사용한다. 이 함수를 사용하여 문자열을 datetime64 형식으로 변환하고 데이터프레임의 x축으로 사용할 수 있다. df['Time'] = pd.to_datetime(df['time']) import matplotlib.pyplot as plt import matplotlib.dates as mdates fig, ax = plt.subplots() ax.plot(df['Time'], df['Value']) ax.set_xlabel('Time') ax.set_ylabel('Value') ax.set_title('Time vs Value') # x축 눈금 간격 설정 (1시간 간격으로 눈금 표시).. 2023. 7. 28. 이전 1 다음 728x90 반응형 LIST