In [1]:
import pandas
In [2]:
df = pandas.io.excel.read_excel('./ExchangeRates.xlsx')
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-2-ba74e604e1e7> in <module>()
----> 1 df = pandas.io.excel.read_excel('./ExchangeRates.xlsx')
/usr/lib/python2.7/site-packages/pandas/io/excel.pyc in read_excel(io, sheetname, **kwds)
125 engine = kwds.pop('engine', None)
126
--> 127 return ExcelFile(io, engine=engine).parse(sheetname=sheetname, **kwds)
128
129
/usr/lib/python2.7/site-packages/pandas/io/excel.pyc in __init__(self, io, **kwds)
143 def __init__(self, io, **kwds):
144
--> 145 import xlrd # throw an ImportError if we need to
146
147 ver = tuple(map(int, xlrd.__VERSION__.split(".")[:2]))
ImportError: No module named xlrd
In [3]:
df = pandas.io.excel.read_excel('./ExchangeRates.xlsx')
In [4]:
df.head()
Out[4]:
VALUEDATE
SOURCECURRENCY
TARGETCURRENCY
RATE
0
2012-01-02
AED
CHF
0.2556
1
2012-01-02
ARS
CHF
0.2181
2
2012-01-02
AUD
CHF
0.9594
3
2012-01-02
BGN
CHF
0.6191
4
2012-01-02
BRL
CHF
0.5039
In [5]:
datestring = "2012-01-02"
In [6]:
date(*map(int, reversed(date_string.split("-"))))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-6-fbd2fedf3de5> in <module>()
----> 1 date(*map(int, reversed(date_string.split("-"))))
NameError: name 'date' is not defined
In [7]:
import date
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-7-c9fb87721c28> in <module>()
----> 1 import date
ImportError: No module named date
In [8]:
date(*map(int, reversed(date_string.split("-"))))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-8-fbd2fedf3de5> in <module>()
----> 1 date(*map(int, reversed(date_string.split("-"))))
NameError: name 'date' is not defined
In [9]:
from datetime import date, datetime
In [10]:
date(*map(int, reversed(date_string.split("-"))))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-10-fbd2fedf3de5> in <module>()
----> 1 date(*map(int, reversed(date_string.split("-"))))
NameError: name 'date_string' is not defined
In [11]:
date_string = "2012-01-02"
In [12]:
date(*map(int, reversed(date_string.split("-"))))
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-12-fbd2fedf3de5> in <module>()
----> 1 date(*map(int, reversed(date_string.split("-"))))
ValueError: day is out of range for month
In [13]:
datestring
Out[13]:
'2012-01-02'
In [14]:
datestring.split('-')
Out[14]:
['2012', '01', '02']
In [15]:
df.head()
Out[15]:
VALUEDATE
SOURCECURRENCY
TARGETCURRENCY
RATE
0
2012-01-02
AED
CHF
0.2556
1
2012-01-02
ARS
CHF
0.2181
2
2012-01-02
AUD
CHF
0.9594
3
2012-01-02
BGN
CHF
0.6191
4
2012-01-02
BRL
CHF
0.5039
In [16]:
df
Out[16]:
VALUEDATE
SOURCECURRENCY
TARGETCURRENCY
RATE
0
2012-01-02
AED
CHF
0.2556
1
2012-01-02
ARS
CHF
0.2181
2
2012-01-02
AUD
CHF
0.9594
3
2012-01-02
BGN
CHF
0.6191
4
2012-01-02
BRL
CHF
0.5039
5
2012-01-02
CAD
CHF
0.9212
6
2012-01-02
CNY
CHF
0.1490
7
2012-01-02
CYP
CHF
2.0764
8
2012-01-02
CZK
CHF
0.0475
9
2012-01-02
DKK
CHF
0.1635
10
2012-01-02
EUR
CHF
1.2153
11
2012-01-02
GBP
CHF
1.4551
12
2012-01-02
HKD
CHF
0.1209
13
2012-01-02
HRK
CHF
0.1612
14
2012-01-02
HUF
CHF
0.0039
15
2012-01-02
ILS
CHF
0.2461
16
2012-01-02
INR
CHF
0.0176
17
2012-01-02
ISK
CHF
0.0046
18
2012-01-02
JPY
CHF
0.0122
19
2012-01-02
KRW
CHF
0.0008
20
2012-01-02
KWD
CHF
3.3737
21
2012-01-02
MXN
CHF
0.0671
22
2012-01-02
MYR
CHF
0.2962
23
2012-01-02
NOK
CHF
0.1571
24
2012-01-02
NZD
CHF
0.7301
25
2012-01-02
PLN
CHF
0.2722
26
2012-01-02
QAR
CHF
0.2578
27
2012-01-02
RON
CHF
0.2812
28
2012-01-02
RSD
CHF
0.0115
29
2012-01-02
RUB
CHF
0.0292
...
...
...
...
...
30266
2015-03-20
CAD
CHF
0.7801
30267
2015-03-20
CNY
CHF
0.1593
30268
2015-03-20
CZK
CHF
0.0385
30269
2015-03-20
DKK
CHF
0.1416
30270
2015-03-20
EUR
CHF
1.0552
30271
2015-03-20
GBP
CHF
1.4585
30272
2015-03-20
HKD
CHF
0.1275
30273
2015-03-20
HRK
CHF
0.1381
30274
2015-03-20
HUF
CHF
0.0035
30275
2015-03-20
ILS
CHF
0.2446
30276
2015-03-20
INR
CHF
0.0158
30277
2015-03-20
ISK
CHF
0.0053
30278
2015-03-20
JPY
CHF
0.0082
30279
2015-03-20
KRW
CHF
0.0009
30280
2015-03-20
KWD
CHF
3.2982
30281
2015-03-20
MXN
CHF
0.0650
30282
2015-03-20
MYR
CHF
0.2657
30283
2015-03-20
NOK
CHF
0.1224
30284
2015-03-20
NZD
CHF
0.7363
30285
2015-03-20
PLN
CHF
0.2559
30286
2015-03-20
QAR
CHF
0.2719
30287
2015-03-20
RON
CHF
0.2387
30288
2015-03-20
RSD
CHF
0.0088
30289
2015-03-20
RUB
CHF
0.0165
30290
2015-03-20
SAR
CHF
0.2640
30291
2015-03-20
SEK
CHF
0.1140
30292
2015-03-20
SGD
CHF
0.7126
30293
2015-03-20
TND
CHF
0.5042
30294
2015-03-20
USD
CHF
0.9891
30295
2015-03-20
ZAR
CHF
0.0808
30296 rows × 4 columns
In [17]:
df['pair'] = df['SOURCECURRENCY'] + df['TARGETCURRENCY']
In [18]:
df
Out[18]:
VALUEDATE
SOURCECURRENCY
TARGETCURRENCY
RATE
pair
0
2012-01-02
AED
CHF
0.2556
AEDCHF
1
2012-01-02
ARS
CHF
0.2181
ARSCHF
2
2012-01-02
AUD
CHF
0.9594
AUDCHF
3
2012-01-02
BGN
CHF
0.6191
BGNCHF
4
2012-01-02
BRL
CHF
0.5039
BRLCHF
5
2012-01-02
CAD
CHF
0.9212
CADCHF
6
2012-01-02
CNY
CHF
0.1490
CNYCHF
7
2012-01-02
CYP
CHF
2.0764
CYPCHF
8
2012-01-02
CZK
CHF
0.0475
CZKCHF
9
2012-01-02
DKK
CHF
0.1635
DKKCHF
10
2012-01-02
EUR
CHF
1.2153
EURCHF
11
2012-01-02
GBP
CHF
1.4551
GBPCHF
12
2012-01-02
HKD
CHF
0.1209
HKDCHF
13
2012-01-02
HRK
CHF
0.1612
HRKCHF
14
2012-01-02
HUF
CHF
0.0039
HUFCHF
15
2012-01-02
ILS
CHF
0.2461
ILSCHF
16
2012-01-02
INR
CHF
0.0176
INRCHF
17
2012-01-02
ISK
CHF
0.0046
ISKCHF
18
2012-01-02
JPY
CHF
0.0122
JPYCHF
19
2012-01-02
KRW
CHF
0.0008
KRWCHF
20
2012-01-02
KWD
CHF
3.3737
KWDCHF
21
2012-01-02
MXN
CHF
0.0671
MXNCHF
22
2012-01-02
MYR
CHF
0.2962
MYRCHF
23
2012-01-02
NOK
CHF
0.1571
NOKCHF
24
2012-01-02
NZD
CHF
0.7301
NZDCHF
25
2012-01-02
PLN
CHF
0.2722
PLNCHF
26
2012-01-02
QAR
CHF
0.2578
QARCHF
27
2012-01-02
RON
CHF
0.2812
RONCHF
28
2012-01-02
RSD
CHF
0.0115
RSDCHF
29
2012-01-02
RUB
CHF
0.0292
RUBCHF
...
...
...
...
...
...
30266
2015-03-20
CAD
CHF
0.7801
CADCHF
30267
2015-03-20
CNY
CHF
0.1593
CNYCHF
30268
2015-03-20
CZK
CHF
0.0385
CZKCHF
30269
2015-03-20
DKK
CHF
0.1416
DKKCHF
30270
2015-03-20
EUR
CHF
1.0552
EURCHF
30271
2015-03-20
GBP
CHF
1.4585
GBPCHF
30272
2015-03-20
HKD
CHF
0.1275
HKDCHF
30273
2015-03-20
HRK
CHF
0.1381
HRKCHF
30274
2015-03-20
HUF
CHF
0.0035
HUFCHF
30275
2015-03-20
ILS
CHF
0.2446
ILSCHF
30276
2015-03-20
INR
CHF
0.0158
INRCHF
30277
2015-03-20
ISK
CHF
0.0053
ISKCHF
30278
2015-03-20
JPY
CHF
0.0082
JPYCHF
30279
2015-03-20
KRW
CHF
0.0009
KRWCHF
30280
2015-03-20
KWD
CHF
3.2982
KWDCHF
30281
2015-03-20
MXN
CHF
0.0650
MXNCHF
30282
2015-03-20
MYR
CHF
0.2657
MYRCHF
30283
2015-03-20
NOK
CHF
0.1224
NOKCHF
30284
2015-03-20
NZD
CHF
0.7363
NZDCHF
30285
2015-03-20
PLN
CHF
0.2559
PLNCHF
30286
2015-03-20
QAR
CHF
0.2719
QARCHF
30287
2015-03-20
RON
CHF
0.2387
RONCHF
30288
2015-03-20
RSD
CHF
0.0088
RSDCHF
30289
2015-03-20
RUB
CHF
0.0165
RUBCHF
30290
2015-03-20
SAR
CHF
0.2640
SARCHF
30291
2015-03-20
SEK
CHF
0.1140
SEKCHF
30292
2015-03-20
SGD
CHF
0.7126
SGDCHF
30293
2015-03-20
TND
CHF
0.5042
TNDCHF
30294
2015-03-20
USD
CHF
0.9891
USDCHF
30295
2015-03-20
ZAR
CHF
0.0808
ZARCHF
30296 rows × 5 columns
In [19]:
df.head()
Out[19]:
VALUEDATE
SOURCECURRENCY
TARGETCURRENCY
RATE
pair
0
2012-01-02
AED
CHF
0.2556
AEDCHF
1
2012-01-02
ARS
CHF
0.2181
ARSCHF
2
2012-01-02
AUD
CHF
0.9594
AUDCHF
3
2012-01-02
BGN
CHF
0.6191
BGNCHF
4
2012-01-02
BRL
CHF
0.5039
BRLCHF
In [20]:
df.groupby(['pair'])
Out[20]:
<pandas.core.groupby.DataFrameGroupBy object at 0x7f5dc319ec10>
In [21]:
df2 = df.groupby(['pair'])
In [22]:
df2
Out[22]:
<pandas.core.groupby.DataFrameGroupBy object at 0x7f5dc2e5b690>
In [23]:
df['pair'].to_list()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-23-5ead40bf24e5> in <module>()
----> 1 df['pair'].to_list()
/usr/lib/python2.7/site-packages/pandas/core/generic.pyc in __getattr__(self, name)
1934 return self[name]
1935 raise AttributeError("'%s' object has no attribute '%s'" %
-> 1936 (type(self).__name__, name))
1937
1938 def __setattr__(self, name, value):
AttributeError: 'Series' object has no attribute 'to_list'
In [24]:
df['pair'].tolist()
Out[24]:
[u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'BGNCHF',
u'BRLCHF',
u'CNYCHF',
u'HRKCHF',
u'ILSCHF',
u'INRCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SGDCHF',
u'THBCHF',
u'TRYCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'BGNCHF',
u'BRLCHF',
u'CNYCHF',
u'HRKCHF',
u'ILSCHF',
u'INRCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SGDCHF',
u'THBCHF',
u'TRYCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
u'EURCHF',
u'GBPCHF',
u'HKDCHF',
u'HRKCHF',
u'HUFCHF',
u'ILSCHF',
u'INRCHF',
u'ISKCHF',
u'JPYCHF',
u'KRWCHF',
u'KWDCHF',
u'MXNCHF',
u'MYRCHF',
u'NOKCHF',
u'NZDCHF',
u'PLNCHF',
u'QARCHF',
u'RONCHF',
u'RSDCHF',
u'RUBCHF',
u'SARCHF',
u'SEKCHF',
u'SGDCHF',
u'THBCHF',
u'TNDCHF',
u'TRYCHF',
u'USDCHF',
u'ZARCHF',
u'AEDCHF',
u'ARSCHF',
u'AUDCHF',
u'BGNCHF',
u'BRLCHF',
u'CADCHF',
u'CNYCHF',
u'CYPCHF',
u'CZKCHF',
u'DKKCHF',
...]
In [25]:
pairs = df['pair'].tolist()
In [26]:
times = df['pair'].tolist()
In [27]:
df.head()
Out[27]:
VALUEDATE
SOURCECURRENCY
TARGETCURRENCY
RATE
pair
0
2012-01-02
AED
CHF
0.2556
AEDCHF
1
2012-01-02
ARS
CHF
0.2181
ARSCHF
2
2012-01-02
AUD
CHF
0.9594
AUDCHF
3
2012-01-02
BGN
CHF
0.6191
BGNCHF
4
2012-01-02
BRL
CHF
0.5039
BRLCHF
In [28]:
values = df['RATE'].tolist()
In [29]:
data = dict()
In [30]:
for pair in pairs:
File "<ipython-input-30-dae035ed34f5>", line 1
for pair in pairs:
^
SyntaxError: unexpected EOF while parsing
In [31]:
times = df['VALUEDATE'].tolist()
In [32]:
for i in range(0, pairs.size()):
pair = pairs[i]
if pair not in data:
data[pair] = []
data[pair]["time"] = times[i]
data[pair]["value"] = values[i]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-32-9818a781d6cb> in <module>()
----> 1 for i in range(0, pairs.size()):
2 pair = pairs[i]
3 if pair not in data:
4 data[pair] = []
5 data[pair]["time"] = times[i]
AttributeError: 'list' object has no attribute 'size'
In [33]:
for i in range(0, size(pairs)):
pair = pairs[i]
if pair not in data:
data[pair] = []
data[pair]["time"] = times[i]
data[pair]["value"] = values[i]
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-33-7940bd6ebaed> in <module>()
----> 1 for i in range(0, size(pairs)):
2 pair = pairs[i]
3 if pair not in data:
4 data[pair] = []
5 data[pair]["time"] = times[i]
NameError: name 'size' is not defined
In [34]:
for i in range(0, pairs.lenght()):
pair = pairs[i]
if pair not in data:
data[pair] = []
data[pair]["time"] = times[i]
data[pair]["value"] = values[i]
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-34-d80404ad1835> in <module>()
----> 1 for i in range(0, pairs.lenght()):
2 pair = pairs[i]
3 if pair not in data:
4 data[pair] = []
5 data[pair]["time"] = times[i]
AttributeError: 'list' object has no attribute 'lenght'
In [35]:
for i in range(0, len(pairs)):
pair = pairs[i]
if pair not in data:
data[pair] = []
data[pair]["time"] = times[i]
data[pair]["value"] = values[i]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-b5196cc33741> in <module>()
3 if pair not in data:
4 data[pair] = []
----> 5 data[pair]["time"] = times[i]
6 data[pair]["value"] = values[i]
TypeError: list indices must be integers, not str
Content source: sixify/sixify
Similar notebooks: