-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformatting_data.py
51 lines (44 loc) · 2.08 KB
/
formatting_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# -*- coding: utf-8 -*-
"""formatting_data.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1Jj0O_slAbJjYDPV7N9b0e5WXlgbl57Bf
"""
import numpy as np
import pandas as pd
from google.colab import files
files.upload() # upload studentAssesment_original.csv and online_classroom_data_original.csv
files.upload()
# FORMATTING online_classroom_data_original.csv
data1 = pd.read_csv('online_classroom_data_original.csv', decimal = ',')
data1 = data1.drop(columns = ['student', 'total_posts', 'timeonline', 'helpful_post', 'nice_code_post', 'collaborative_post', 'confused_post', 'creative_post', 'bad_post', 'amazing_post', 'Approved'])
col = data1.loc[: , "sk1_classroom":"sk4_classroom"]
data1['avg_score'] = col.mean(axis=1)
dataset = pd.read_csv('online_classroom_data_original.csv', decimal = ',')
dataset = dataset.drop(columns = ['student', 'sk1_classroom', 'helpful_post', 'nice_code_post', 'collaborative_post', 'confused_post', 'creative_post', 'bad_post', 'amazing_post', 'sk2_classroom', 'sk5_classroom', 'sk3_classroom', 'sk4_classroom', 'Approved'])
data1['avg_score'] *= 10
data1 = data1.drop(columns = ['sk1_classroom', 'sk2_classroom', 'sk3_classroom', 'sk5_classroom', 'sk4_classroom'])
dataset['final_score']= data1['avg_score']
dataset.columns = ['total_posts', 'time_online', 'final_score']
dataset = dataset.astype('float')
z1 = dataset['total_posts']
y1 = dataset['final_score']
x1 = dataset['time_online']
x1 /= 960
z1 /= 16
x1 /= 3
dataset = dataset[~(x1 >= 12) | ~(y1 <=200)]
dataset.to_csv('online_classroom_data_formatted.csv')
# FORMATTING studentAssesment_original.csv
dataset = pd.read_csv('studentAssesment_original.csv')
dataset = dataset.drop(columns = ['id_assessment', 'id_student', 'is_banked'])
dataset = dataset.dropna()
dataset = dataset[:359]
dataset.columns = ['date_submitted', 'final_score']
x = dataset['date_submitted']
y = dataset['final_score']
x /= np.max(x) / 14
x = dataset['date_submitted']
y = dataset['final_score']
dataset = dataset[~(x >= 8) | ~(y <=200)]
dataset.to_csv('studentAssesment_formatted.csv')