টাইমস্ট্যাম্প অবজেক্ট থেকে সপ্তাহের দিন পেতে, timestamp.weekday() ব্যবহার করুন পদ্ধতি প্রথমে, প্রয়োজনীয় লাইব্রেরিগুলি আমদানি করুন -
import pandas as pd import datetime
পান্ডাসে টাইমস্ট্যাম্প সেট করুন। একটি টাইমস্ট্যাম্প অবজেক্ট তৈরি করুন
timestamp = pd.Timestamp(datetime.datetime(2021, 5, 12))
বছরের সপ্তাহের দিন পান। সপ্তাহের দিন সোমবার ==0, মঙ্গলবার ==1 … রবিবার ==6
timestamp.weekday()
উদাহরণ
নিচের কোড
import pandas as pd
import datetime
# set the timestamp in Pandas
# create a Timestamp object
timestamp = pd.Timestamp(datetime.datetime(2021, 5, 12))
# display the Timestamp
print("Timestamp...\n", timestamp)
# getting the weekday of the year
res = timestamp.weekday()
# display only the weekday
# weekday represented by number Monday == 0, Tuesday == 1 … Sunday == 6
print("\nGet the weekday from Timestamp...\n", res) আউটপুট
এটি নিম্নলিখিত কোড তৈরি করবে
Timestamp... 2021-05-12 00:00:00 Get the weekday from Timestamp... 2