Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
673 B
21
Indexable
Never
import pandas as pd

# напишите ваш код здесь
users_data = pd.read_csv('users_data.csv')
users_data['session_start_ts'] = pd.to_datetime(users_data['session_start_ts'])
users_data['session_end_ts'] = pd.to_datetime(users_data['session_end_ts'])
users_data['session_year'] = users_data['session_start_ts'].dt.year
users_data['session_month'] = users_data['session_start_ts'].dt.month
users_data['session_week'] = users_data['session_start_ts'].dt.isocalendar().week
users_data['session_date'] = users_data['session_start_ts'].dt.date
mau_total = users_data.groupby(['session_year', 'session_month'])['id'].nunique().mean()
print(int(mau_total))