কম্পিউটার টিউটোরিয়াল

পাইথন পান্ডাস - CustomBusinessHour অফসেট থেকে স্টার্ট টাইম দেখানো

পান্ডাসে CustomBusinessHour.start প্রোপার্টি ব্যবহার করে কাস্টম বিজনেস আওয়ারের শুরু সময় (২৪ ঘণ্টা ফরম্যাটে) দেখানো যায়।

প্রক্রিয়া

  1. import pandas as pd
  2. timestamp = pd.Timestamp('2021-11-14 05:20:30')
  3. cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end="18:00", n=8)
  4. অফসেট যোগ করে আপডেটেড টাইমস্ট্যাম্প দেখুন।
  5. cbhOffset.start দিয়ে স্টার্ট টাইম দেখুন।

উদাহরণ কোড

import pandas as pd

timestamp = pd.Timestamp('2021-11-14 05:20:30')
print("Timestamp...\n", timestamp)

cbhOffset = pd.tseries.offsets.CustomBusinessHour(start="09:30", end="18:00", n=8)
print("\nCustomBusinessHour Offset...\n", cbhOffset)

print("\nUpdated Timestamp...\n", timestamp + cbhOffset)

print("\nThe start time of the custom business hour...\n", cbhOffset.start)

আউটপুট

Timestamp... 2021-11-14 05:20:30
CustomBusinessHour Offset... <8 * CustomBusinessHours: CBH=09:30-18:00>
Updated Timestamp... 2021-11-15 17:30:00
The start time of the custom business hour... (datetime.time(9, 30),)
  1. পাইথন পান্ডাস - Period অবজেক্টের শুরুতে সময় বের করার পদ্ধতি

  2. পাইথন - প্যান্ডাসে Timestamp অবজেক্ট থেকে সপ্তাহের দিন পান

  3. পাইথন প্যান্ডাস - UTC অফসেট সময় পান

  4. পাইথন প্যান্ডাস - Timestamp অবজেক্ট থেকে বর্তমান তারিখ এবং সময় পান