تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
1724 أدوات العرض
Hello thanks for answering I have tried this but it still does not return the days between the two dates. Could you help me find the error?

for record in datetime:
        record ['x_ftest'] = record.x_farribo - record.x_eta

and this is the error that returns:
ValueError: <class 'TypeError'>: "'WrappedModule' object is not iterable" while evaluating
"for record in datetime: \ n record ['x_ftest'] = record.x_farribo - record.x_eta"

الصورة الرمزية
إهمال
أفضل إجابة

Hi,

Could you please try to check the days count based on the given code

from datetime import date

date1 = date(2023, 1, 1)  # Assuming the first date is January 1, 2023
date2 = date(2023, 1, 10)  # Assuming the second date is January 10, 2023

delta = date2 - date1  # Calculate the time difference
days_between = delta.days  # Extract the number of days

and also Make sure that the elements in the datetime list are dictionaries or objects that support dictionary-like access using square brackets (record['x_farribo'] and record['x_age']). If you're using a different data structure, adapt the code accordingly. some times the datatypes error got this kind of error

Hope it helps


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
2
أبريل 25
477
1
أبريل 25
383
3
سبتمبر 24
12241
2
فبراير 24
1494
2
يونيو 23
2385