DateTime Handling
Pandas has excellent support for dates and times through the datetime64 type.
Parsing Date Strings
Convert strings to datetime:
Loading Pandas Playground...
Different Date Formats
Handle various date formats:
Loading Pandas Playground...
Extracting Date Components
Use .dt accessor for date parts:
Loading Pandas Playground...
Date Arithmetic
Perform calculations with dates:
Loading Pandas Playground...
Filtering by Date
Filter data using date conditions:
Loading Pandas Playground...
Setting DateTime Index
Use dates as the index for time series:
Loading Pandas Playground...
Exercise: Parse Dates
Loading Exercise...
Exercise: Extract Month
Loading Exercise...
Key Points
pd.to_datetime()converts strings to datetime- Use
format=for non-standard date formats .dtaccessor for date components (year, month, day)- Subtract dates to get timedelta
pd.Timedelta()for adding/subtracting time- Date indices enable easy time-based slicing
التالي · الدرس 18 من 42
Type Conversion
قراءة 1 دقيقة
أنهيت 17 من 42 درسًا

اسأل Byte عن هذا الدرس
محادثة خاصة حول هذا الدرس. قرأ Byte الدرس كاملًا، ويجيب خلال ثوانٍ، ويُظهر القسم الذي تأتي منه كل إجابة. يمكنك السؤال بأي لغة.
الأسئلة والأجوبة
أسئلة عامة حول هذا الدرس. يجيب AI Tutor فورًا بلغتك، ويراجع فريق FreeAcademy الإجابات، ويمكن لكل المتعلمين قراءتها.

