From 9b5f392f7f66dcb2d010bb58e48aadbdb818b4f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D1=83=D1=85=D0=BE=D1=80=D1=83=D0=BA=D0=BE=D0=B2?= Date: Sat, 31 Jan 2026 17:20:37 +0000 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?/=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comparison.py | 2 ++ count_sum_pandas.py | 5 +++++ last_friday_datetime.py | 10 ++++++++++ 3 files changed, 17 insertions(+) create mode 100644 comparison.py create mode 100644 count_sum_pandas.py create mode 100644 last_friday_datetime.py diff --git a/comparison.py b/comparison.py new file mode 100644 index 0000000..48d7f43 --- /dev/null +++ b/comparison.py @@ -0,0 +1,2 @@ +def compare(z: str)->bool: + return eval(z) \ No newline at end of file diff --git a/count_sum_pandas.py b/count_sum_pandas.py new file mode 100644 index 0000000..1d45431 --- /dev/null +++ b/count_sum_pandas.py @@ -0,0 +1,5 @@ +import pandas as pd + + +def count_sum(df: pd.DataFrame)->pd.DataFrame: + return df.groupby('Товар')['Количество'].sum().to_frame() \ No newline at end of file diff --git a/last_friday_datetime.py b/last_friday_datetime.py new file mode 100644 index 0000000..73e8556 --- /dev/null +++ b/last_friday_datetime.py @@ -0,0 +1,10 @@ +from datetime import datetime, timedelta +import calendar + +def get_last_friday(month_year: str) -> str: + month, year = map(int, month_year.split('/')) + last_day = calendar.monthrange(year, month)[1] + date_obj = datetime(year, month, last_day) + offset = (date_obj.weekday() - 4) % 7 + last_friday = date_obj - timedelta(days=offset) + return last_friday.strftime("%d.%m.%Y") \ No newline at end of file