Kaggle competition: Предсказание положения космических объектов
<SOS> metric: smape Kaggle data source: sputnik<categorify>
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
def FamilyGroup(family):
a=''
if family<=1:
a='Single'
elif family<=4:
a='Small'
else:
a='Large'
return a
titanic['FamilyGroup']=titanic['Family'].map(FamilyGroup)
 titanic=titanic.drop(['Family'],axis=1 )<categorify>
df = pd.read_csv('.. /input/sputnik/train.csv')
 df['Datetime'] = pd.to_datetime(df.epoch,format='%Y-%m-%d %H:%M:%S')
 df.index = df.Datetime
df = df.drop(['epoch', 'Datetime'], axis=1)
 df.head()
def AgeGroup(age):
a=''
if age<=15:
a='Child'
elif age<=30:
a='Young'
elif age<=50:
a='Adult'
else:
a='Old'
return a
titanic['AgeGroup']=titanic['Age'].map(AgeGroup)
 titanic=titanic.drop(['Age'],axis=1 )<drop_column>
for sat_id in np.unique(df['sat_id'].values):
print(sat_id, end = ' ')
 frame = df[df['sat_id'] == sat_id]
for v in ['x', 'y', 'z']:
e = frame[v].values
t = frame['type'].values
for i in range(len(frame[v])) :
if t[i] == 'test':
e[i] = e[i - 24] +(e[i - 24] - e[i - 48])
 df[df['sat_id'] == sat_id] = frame
titanic=titanic.drop(['PassengerId','TicketFreq','Ticket','Fare','Title','Surname'], axis=1 )<categorify>
df['error'] = np.linalg.norm(df[['x', 'y', 'z']].values - df[['x_sim', 'y_sim', 'z_sim']].values, axis=1 )
<filter><EOS> 
ans = df[df['type'] == 'test'][['id', 'error']]
ans
ans.to_csv('ans.csv', index=False )