Last active
December 19, 2016 08:43
-
-
Save aidiss/964a0a054c002cfd4fc4726b96a3c3d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
def eliminate_nuokrypiai(group, stds, zymejimas): | |
group[np.abs(group - group.mean()) > stds * group.std()] = zymejimas | |
return group | |
def palikti_nuokrypius(group, stds, zymejimas): | |
group[np.abs(group - group.mean()) <= stds * group.std()] = zymejimas | |
return group | |
# Pagal dėstytojo vertinimus studijų modulyje | |
index = ['Dėst', 'Studijų modulio kodas', 'Studijų modulio pavadinimas'] | |
l = [] | |
for klausimo_kodas in uzdaru_kodai_dest: | |
data = dfdest.set_index(index) | |
grouped = data.groupby(data.index) | |
filtered = grouped[klausimo_kodas] | |
transformed = filtered.transform(lambda x: eliminate_nuokrypiai(x, 2, np.nan)) | |
l.append(transformed) | |
pagal_destytojo_vertinimus_modulyje = pd.concat(l, axis=1) | |
# Pagal modulių vertinimus | |
index = ['Studijų modulio kodas', 'Studijų modulio pavadinimas',] | |
l = [] | |
for klausimo_kodas in uzdaru_kodai_mod: | |
data = dfmod.set_index(index) | |
grouped = data.groupby(data.index) | |
filtered = grouped[klausimo_kodas] | |
transformed = filtered.transform(lambda x: eliminate_nuokrypiai(x, 2, np.nan)) | |
l.append(transformed) | |
pagal_moduliu_vertinimus = pd.concat(l, axis=1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment