commit 9b5f392f7f66dcb2d010bb58e48aadbdb818b4f1 Author: Сухоруков Date: Sat Jan 31 17:20:37 2026 +0000 Загрузить файлы в «/» 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