MAI/LabWork01/LabWork3/AddData.py
2023-10-11 21:05:27 +04:00

18 lines
678 B
Python

import pandas
# создаём усовершенствованную таблицу
def addData(df: pandas.DataFrame):
# узнаём средние значения для всех столбцов
mean_store_sales = df['Store_Sales'].mean()
mean_daily_customer_count = df['Daily_Customer_Count'].mean()
mean_items_available = df['Items_Available'].mean()
mean_store_area = df['Store_Area'].mean()
additionForTable = int(len(df) / 10)
# добавили 10% значений
for i in range(additionForTable):
df.loc[len(df.index)] = [mean_store_area, mean_items_available, mean_daily_customer_count, mean_store_sales]
return df