Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
TA13
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
12
Issues
12
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Febby B. Simanjuntak
TA13
Commits
2d671302
Commit
2d671302
authored
Jun 23, 2020
by
Febby B. Simanjuntak
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'MOORA' into 'master'
moora See merge request
!4
parents
c961a851
63fae374
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
254 additions
and
0 deletions
+254
-0
Untitled.ipynb
Untitled.ipynb
+254
-0
No files found.
Untitled.ipynb
0 → 100644
View file @
2d671302
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os,django\n",
"import pandas as pd\n",
"from orm.models import Siswa,Kelas,Karakter\n",
"import math"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'Siswa' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-1-eabc7ddc4584>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m 1\u001b[0m \u001b[1;31m# Kelas\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m \u001b[0msw\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mSiswa\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mobjects\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mall\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 3\u001b[0m \u001b[0mkl\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mKelas\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mobjects\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mall\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 4\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 5\u001b[0m \u001b[1;32mdef\u001b[0m \u001b[0mListKelas\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0msw\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;31mNameError\u001b[0m: name 'Siswa' is not defined"
]
}
],
"source": [
"# Kelas\n",
"sw=Siswa.objects.all()\n",
"kl=Kelas.objects.all()\n",
"\n",
"def ListKelas(sw):\n",
" if len(sw)>0:\n",
" cols = ['Nilai']\n",
" \n",
" kel ={\n",
" cols[0] : [int(a.kelass.nilai) for a in sw],\n",
" }\n",
" dfkel = pd.DataFrame(data=kel)\n",
" return dfkel\n",
" else:\n",
" return[]\n",
"\n",
"def Hasil_Kelas():\n",
" kl=ListKelas(sw)\n",
" b = 0\n",
" tampung=[]\n",
" for y in range(len(sw)):\n",
" a=(math.pow(kl.Nilai[y],2))\n",
" b = b+a\n",
" for i in range(len(sw)):\n",
" s = kl.Nilai[i]\n",
" ad=s/(math.sqrt(b))\n",
" tampung.append(ad)\n",
" \n",
" swa={'nama':[a.nama for a in sw]}\n",
" \n",
" if len(sw)>0:\n",
" cols = ['Jenjang']\n",
" \n",
" kel ={\n",
" cols[0] : [str(a.kelass.jenjang) for a in sw],\n",
" }\n",
" dfkel = pd.DataFrame(data=kel)\n",
" \n",
" \n",
" dfswa= pd.DataFrame(data=swa)\n",
" Kelas=pd.DataFrame(data=tampung,columns=['Nilai'])\n",
" new = pd.concat([dfswa,dfkel, Kelas], axis=1)\n",
" return new\n",
"\n",
"\n",
"def HasilKelas_Pembobotan():\n",
" b=Hasil_Kelas()\n",
" lst=list(b)\n",
" y=0\n",
" d=[]\n",
" lst\n",
" \n",
" for i in range(len(b)):\n",
" y =0.3*b.Nilai[i]\n",
" d.append(y)\n",
" pb=pd.DataFrame(d,columns=['Nilai'])\n",
" swa={'nama':[a.nama for a in sw]}\n",
" dfswa= pd.DataFrame(data=swa)\n",
" # Kelas=pd.DataFrame(data=tampung,columns=['Nilai'])\n",
" new = pd.concat([dfswa, pb], axis=1)\n",
" return new"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"HasilKelas_Pembobotan()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"Hasil_Kelas()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def ListKelasJn(sw):\n",
" if len(sw)>0:\n",
" cols = ['Jenjang']\n",
" \n",
" kel ={\n",
" cols[0] : [str(a.kelass.jenjang) for a in sw],\n",
" }\n",
" dfkel = pd.DataFrame(data=kel)\n",
" return dfkel\n",
" else:\n",
" return[]\n",
"ListKelasJn(sw)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def Bobot_MTK():\n",
" b=Hasil_Kelas()\n",
" lst=list(b)\n",
" y=0\n",
" d=[]\n",
" lst\n",
" for i in range(len(lst)):\n",
" y =0.3*lst[i]\n",
" d.append(y)\n",
" pb=pd.DataFrame(d,columns=['Nilai'])\n",
" swa={'nama':[a.nama for a in sw]}\n",
" dfswa= pd.DataFrame(data=swa)\n",
" new = pd.concat([dfswa, pb], axis=1)\n",
" return new\n",
"\n",
"Bobot_MTK()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"krt=Karakter.objects.all()\n",
"def ListAkademik(krt):\n",
" if len(krt)>0:\n",
" cols = ['matapelajaran','nilai']\n",
" kel ={\n",
" cols[0] : [str(a.matapelajaran) for a in ak],\n",
" cols[1] : [int(a.nilai) for a in ak],\n",
" }\n",
" dfkel = pd.DataFrame(data=kel)\n",
" return dfkel\n",
" else:\n",
" return[]\n",
"\n",
"ListAkademik(ak)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"def ListKecerdasan(krywn):\n",
" if len(krywn)>0:\n",
" target = [4, 3, 4, 5, 3]\n",
" cols = ['sistematika_berfikir', 'konsentrasi', 'logika_praktis','imajinasi_kreatif','antisipasi']\n",
"\n",
" krn = {'nama': [a.nama for a in krywn]}\n",
" dfkrn = pd.DataFrame(data=krn)\n",
"\n",
" kec = {\n",
" cols[0] : [int(a.kecerdasans.sistematika_berfikir) for a in krywn],\n",
" cols[1] : [int(a.kecerdasans.konsentrasi) for a in krywn],\n",
" cols[2] : [int(a.kecerdasans.logika_praktis) for a in krywn],\n",
" cols[3] : [int(a.kecerdasans.imajinasi_kreatif) for a in krywn],\n",
" cols[4] : [int(a.kecerdasans.antisipasi) for a in krywn],\n",
" }\n",
" dfkec = pd.DataFrame(data=kec)\n",
"\n",
" gap = get_gap(dfkec, target)\n",
" pb = pembobotan(gap, cols)\n",
" new = pd.concat([dfkrn, pb], axis=1)\n",
" return new\n",
" else:\n",
" return []"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment