In [1]:
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')


Out[1]:

In [2]:
import json
import pandas as pd
import matplotlib
from pandas import DataFrame as df
import numpy as np
%matplotlib inline
%pylab inline
pylab.rcParams['figure.figsize'] = (10, 8)

%matplotlib inline
import pandas as pd

from IPython.core.display import HTML
css = open('style-table.css').read() + open('style-notebook.css').read()
HTML('<style>{}</style>'.format(css))


Populating the interactive namespace from numpy and matplotlib
Out[2]:

In [ ]:


In [3]:
path = 'RiskaOS.csv'
open(path).readline()
data = pd.read_csv(path)
data.head()


Out[3]:
RRO RRS TampilanO TampilanS MenuO MenuS PackagingO PackagingS WifiO WifiS PembayaranO PembayaranS PelayananO PelayananS
0 3 1 S S S S S S S S S S S S
1 3 3 S RG S RG S RG RG RG S S S S
2 1 1 SS RG SS S SS S SS TS SS SS SS S
3 2 2 S S S RG RG RG RG RG RG S S S
4 1 4 S STS S STS S STS S TS RG RG SS TS

In [4]:
path = 'RiskaOS.csv'
open(path).readline()
data = pd.read_csv(path)

data = data.replace({'RRO' : { 5 : '1', 4 : '2', 2 : '4', 1 : '5' }})
data = data.replace({'RRS' : { 5 : '1', 4 : '2', 2 : '4', 1 : '5' }})
data = data.replace({'TampilanO' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'TampilanS' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'MenuO' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'MenuS' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'PackagingO' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'PackagingS' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'WifiO' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'WifiS' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'PembayaranO' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'PembayaranS' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'PelayananO' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})
data = data.replace({'PelayananS' : {  'SS' : 5, 'S' : 4, 'RG' : 3, 'TS' : 2, 'STS' : 1}})

data.head()


/home/qbits7/anaconda2/lib/python2.7/site-packages/pandas/core/internals.py:4288: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
  comp = (nn == nn_at)
Out[4]:
RRO RRS TampilanO TampilanS MenuO MenuS PackagingO PackagingS WifiO WifiS PembayaranO PembayaranS PelayananO PelayananS
0 3 5 4 4 4 4 4 4 4 4 4 4 4 4
1 3 3 4 3 4 3 4 3 3 3 4 4 4 4
2 5 5 5 3 5 4 5 4 5 2 5 5 5 4
3 4 4 4 4 4 3 3 3 3 3 3 4 4 4
4 5 2 4 1 4 1 4 1 4 2 3 3 5 2

In [5]:
import csv
data.to_csv('RiskaBersih.csv')

In [6]:
data1 = pd.read_csv('RiskaBersih.csv')

In [ ]: