We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Decoding error in JP price parser
`JP.fetch_price` is failing due to a `UnicodeDecodeError` in `pandas.read_csv`, the CSV file contains Japanese characters. I don't get this issue locally and saw it for the first time on the Kibana logs. 

Maybe it's as simple as passing an `encoding` parameter to `pandas.read_csv`. But I'm using the same version of `pandas` that's specified in the `requirements.txt` file, so maybe that's not it. I can't replicate the issue locally. Any ideas?

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `parsers/JP.py`
Content:
```
1 #!/usr/bin/env python3
2 # coding=utf-8
3 import logging
4 # The arrow library is used to handle datetimes
5 import arrow
6 import datetime as dt
7 import pandas as pd
8 from . import occtonet
9 
10 # Abbreviations
11 # JP-HKD : Hokkaido
12 # JP-TH  : Tohoku
13 # JP-TK  : Tokyo area
14 # JP-CB  : Chubu
15 # JP-HR  : Hokuriku
16 # JP-KN  : Kansai
17 # JP-SK  : Shikoku
18 # JP-KY  : Kyushu
19 # JP-ON  : Okinawa
20 # JP-CG  : Chūgoku
21 
22 
23 def fetch_production(zone_key='JP-TK', session=None, target_datetime=None,
24                      logger=logging.getLogger(__name__)):
25     """
26     Calculates production from consumption and imports for a given area
27     All production is mapped to unknown
28     """
29     if target_datetime:
30         raise NotImplementedError(
31             'This parser is not yet able to parse past dates')
32     exch_map = {
33         'JP-HKD':['JP-TH'],
34         'JP-TH':['JP-TK'],
35         'JP-TK':['JP-TH', 'JP-CB'],
36         'JP-CB':['JP-TK', 'JP-HR', 'JP-KN'],
37         'JP-HR':['JP-CB', 'JP-KN'],
38         'JP-KN':['JP-CB', 'JP-HR', 'JP-SK', 'JP-CG'],
39         'JP-SK':['JP-KN', 'JP-CG'],
40         'JP-CG':['JP-KN', 'JP-SK', 'JP-KY']
41         }
42     df = fetch_consumption_df(zone_key, target_datetime)
43     df['imports'] = 0
44     for zone in exch_map[zone_key]:
45         df2 = occtonet.fetch_exchange(zone_key, zone, target_datetime)
46         df2 = pd.DataFrame(df2)
47         exchname = df2.loc[0, 'sortedZoneKeys']
48         df2 = df2[['datetime', 'netFlow']]
49         df2.columns = ['datetime', exchname]
50         df = pd.merge(df, df2, how='inner', on='datetime')
51         if exchname.split('->')[-1] == zone_key:
52             df['imports'] = df['imports']+df[exchname]
53         else:
54             df['imports'] = df['imports']-df[exchname]
55     df['prod'] = df['cons']-df['imports']
56     df = df[['datetime', 'prod']]
57     # add a row to production for each entry in the dictionary:
58     sources = {
59         'JP-HKD':'denkiyoho.hepco.co.jp',
60         'JP-TH':'setsuden.tohoku-epco.co.jp',
61         'JP-TK':'www.tepco.co.jp',
62         'JP-CB':'denki-yoho.chuden.jp',
63         'JP-HR':'www.rikuden.co.jp/denki-yoho',
64         'JP-KN':'www.kepco.co.jp',
65         'JP-SK':'www.energia.co.jp',
66         'JP-CG':'www.yonden.co.jp'
67         }
68     datalist = []
69     for i in range(df.shape[0]):
70         data = {
71             'zoneKey': zone_key,
72             'datetime': df.loc[i, 'datetime'].to_pydatetime(),
73             'production': {
74                 'biomass': None,
75                 'coal': None,
76                 'gas': None,
77                 'hydro': None,
78                 'nuclear': None,
79                 'oil': None,
80                 'solar': None,
81                 'wind': None,
82                 'geothermal': None,
83                 'unknown': df.loc[i, 'prod']
84             },
85             'storage': {},
86             'source': ['occtonet.or.jp', sources[zone_key]]
87             }
88         datalist.append(data)
89     return datalist
90 
91 
92 def fetch_consumption_df(zone_key='JP-TK', target_datetime=None,
93                       logger=logging.getLogger(__name__)):
94     """
95     Returns the consumption for an area as a pandas DataFrame
96     """
97     datestamp = arrow.get(target_datetime).to('Asia/Tokyo').strftime('%Y%m%d')
98     consumption_url = {
99         'JP-HKD': 'http://denkiyoho.hepco.co.jp/area/data/juyo_01_{}.csv'.format(datestamp),
100         'JP-TH': 'http://setsuden.tohoku-epco.co.jp/common/demand/juyo_02_{}.csv'.format(datestamp),
101         'JP-TK': 'http://www.tepco.co.jp/forecast/html/images/juyo-j.csv',
102         'JP-HR': 'http://www.rikuden.co.jp/denki-yoho/csv/juyo_05_{}.csv'.format(datestamp),
103         'JP-CB': 'http://denki-yoho.chuden.jp/denki_yoho_content_data/juyo_cepco003.csv',
104         'JP-KN': 'http://www.kepco.co.jp/yamasou/juyo1_kansai.csv',
105         'JP-CG': 'http://www.energia.co.jp/jukyuu/sys/juyo_07_{}.csv'.format(datestamp),
106         'JP-SK': 'http://www.yonden.co.jp/denkiyoho/juyo_shikoku.csv'
107         }
108     # First roughly 40 rows of the consumption files have hourly data,
109     # the parser skips to the rows with 5-min actual values 
110     if zone_key == 'JP-KN':
111         startrow = 44
112     else:
113         startrow = 42
114     df = pd.read_csv(consumption_url[zone_key], skiprows=list(range(startrow)),
115                      encoding='shift-jis')
116     df.columns = ['Date', 'Time', 'cons']
117     # Convert 万kW to MW
118     df['cons'] = 10*df['cons']
119     df = df.dropna()
120     df['datetime'] = df.apply(parse_dt, axis=1)
121     df = df[['datetime', 'cons']]
122     return df
123 
124 
125 def fetch_price(zone_key='JP-TK', session=None, target_datetime=None,
126                 logger=logging.getLogger(__name__)):
127     if target_datetime is None:
128         target_datetime = dt.datetime.now() + dt.timedelta(days=1)
129 
130     # price files contain data for fiscal year and not calendar year.
131     if target_datetime.month <= 3:
132         fiscal_year = target_datetime.year - 1
133     else:
134         fiscal_year = target_datetime.year
135     url = 'http://www.jepx.org/market/excel/spot_{}.csv'.format(fiscal_year)
136     df = pd.read_csv(url)
137 
138     df = df.iloc[:, [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14]]
139     df.columns = ['Date', 'Period', 'JP-HKD', 'JP-TH', 'JP-TK', 'JP-CB',
140                   'JP-HR', 'JP-KN', 'JP-CG', 'JP-SK', 'JP-KY']
141 
142     if zone_key not in df.columns[2:]:
143         return []
144 
145     start = target_datetime - dt.timedelta(days=1)
146     df['Date'] = df['Date'].apply(lambda x: dt.datetime.strptime(x, '%Y/%m/%d'))
147     df = df[(df['Date'] >= start.date()) & (df['Date'] <= target_datetime.date())]
148 
149     df['datetime'] = df.apply(lambda row: arrow.get(row['Date']).shift(
150         minutes=30 * (row['Period'] - 1)).replace(tzinfo='Asia/Tokyo'), axis=1)
151 
152     data = list()
153     for row in df.iterrows():
154         data.append({
155             'zoneKey': zone_key,
156             'currency': 'JPY',
157             'datetime': row[1]['datetime'].datetime,
158             'price': row[1][zone_key],
159             'source': 'jepx.org'
160         })
161 
162     return data
163 
164 
165 def parse_dt(row):
166     """
167     Parses timestamps from date and time
168     """
169     return arrow.get(' '.join([row['Date'], row['Time']]).replace('/', '-'),
170                      'YYYY-M-D H:mm').replace(tzinfo='Asia/Tokyo').datetime
171 
172 
173 if __name__ == '__main__':
174     """Main method, never used by the Electricity Map backend, but handy for testing."""
175 
176     print('fetch_production() ->')
177     print(fetch_production())
178     print('fetch_price() ->')
179     print(fetch_price())
180
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/parsers/JP.py b/parsers/JP.py
--- a/parsers/JP.py
+++ b/parsers/JP.py
@@ -133,7 +133,7 @@
     else:
         fiscal_year = target_datetime.year
     url = 'http://www.jepx.org/market/excel/spot_{}.csv'.format(fiscal_year)
-    df = pd.read_csv(url)
+    df = pd.read_csv(url, encoding='shift-jis')
 
     df = df.iloc[:, [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14]]
     df.columns = ['Date', 'Period', 'JP-HKD', 'JP-TH', 'JP-TK', 'JP-CB',

{"golden_diff": "diff --git a/parsers/JP.py b/parsers/JP.py\n--- a/parsers/JP.py\n+++ b/parsers/JP.py\n@@ -133,7 +133,7 @@\n     else:\n         fiscal_year = target_datetime.year\n     url = 'http://www.jepx.org/market/excel/spot_{}.csv'.format(fiscal_year)\n-    df = pd.read_csv(url)\n+    df = pd.read_csv(url, encoding='shift-jis')\n \n     df = df.iloc[:, [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14]]\n     df.columns = ['Date', 'Period', 'JP-HKD', 'JP-TH', 'JP-TK', 'JP-CB',\n", "issue": "Decoding error in JP price parser\n`JP.fetch_price` is failing due to a `UnicodeDecodeError` in `pandas.read_csv`, the CSV file contains Japanese characters. I don't get this issue locally and saw it for the first time on the Kibana logs. \r\n\r\nMaybe it's as simple as passing an `encoding` parameter to `pandas.read_csv`. But I'm using the same version of `pandas` that's specified in the `requirements.txt` file, so maybe that's not it. I can't replicate the issue locally. Any ideas?\n", "before_files": [{"content": "#!/usr/bin/env python3\n# coding=utf-8\nimport logging\n# The arrow library is used to handle datetimes\nimport arrow\nimport datetime as dt\nimport pandas as pd\nfrom . import occtonet\n\n# Abbreviations\n# JP-HKD : Hokkaido\n# JP-TH  : Tohoku\n# JP-TK  : Tokyo area\n# JP-CB  : Chubu\n# JP-HR  : Hokuriku\n# JP-KN  : Kansai\n# JP-SK  : Shikoku\n# JP-KY  : Kyushu\n# JP-ON  : Okinawa\n# JP-CG  : Ch\u016bgoku\n\n\ndef fetch_production(zone_key='JP-TK', session=None, target_datetime=None,\n                     logger=logging.getLogger(__name__)):\n    \"\"\"\n    Calculates production from consumption and imports for a given area\n    All production is mapped to unknown\n    \"\"\"\n    if target_datetime:\n        raise NotImplementedError(\n            'This parser is not yet able to parse past dates')\n    exch_map = {\n        'JP-HKD':['JP-TH'],\n        'JP-TH':['JP-TK'],\n        'JP-TK':['JP-TH', 'JP-CB'],\n        'JP-CB':['JP-TK', 'JP-HR', 'JP-KN'],\n        'JP-HR':['JP-CB', 'JP-KN'],\n        'JP-KN':['JP-CB', 'JP-HR', 'JP-SK', 'JP-CG'],\n        'JP-SK':['JP-KN', 'JP-CG'],\n        'JP-CG':['JP-KN', 'JP-SK', 'JP-KY']\n        }\n    df = fetch_consumption_df(zone_key, target_datetime)\n    df['imports'] = 0\n    for zone in exch_map[zone_key]:\n        df2 = occtonet.fetch_exchange(zone_key, zone, target_datetime)\n        df2 = pd.DataFrame(df2)\n        exchname = df2.loc[0, 'sortedZoneKeys']\n        df2 = df2[['datetime', 'netFlow']]\n        df2.columns = ['datetime', exchname]\n        df = pd.merge(df, df2, how='inner', on='datetime')\n        if exchname.split('->')[-1] == zone_key:\n            df['imports'] = df['imports']+df[exchname]\n        else:\n            df['imports'] = df['imports']-df[exchname]\n    df['prod'] = df['cons']-df['imports']\n    df = df[['datetime', 'prod']]\n    # add a row to production for each entry in the dictionary:\n    sources = {\n        'JP-HKD':'denkiyoho.hepco.co.jp',\n        'JP-TH':'setsuden.tohoku-epco.co.jp',\n        'JP-TK':'www.tepco.co.jp',\n        'JP-CB':'denki-yoho.chuden.jp',\n        'JP-HR':'www.rikuden.co.jp/denki-yoho',\n        'JP-KN':'www.kepco.co.jp',\n        'JP-SK':'www.energia.co.jp',\n        'JP-CG':'www.yonden.co.jp'\n        }\n    datalist = []\n    for i in range(df.shape[0]):\n        data = {\n            'zoneKey': zone_key,\n            'datetime': df.loc[i, 'datetime'].to_pydatetime(),\n            'production': {\n                'biomass': None,\n                'coal': None,\n                'gas': None,\n                'hydro': None,\n                'nuclear': None,\n                'oil': None,\n                'solar': None,\n                'wind': None,\n                'geothermal': None,\n                'unknown': df.loc[i, 'prod']\n            },\n            'storage': {},\n            'source': ['occtonet.or.jp', sources[zone_key]]\n            }\n        datalist.append(data)\n    return datalist\n\n\ndef fetch_consumption_df(zone_key='JP-TK', target_datetime=None,\n                      logger=logging.getLogger(__name__)):\n    \"\"\"\n    Returns the consumption for an area as a pandas DataFrame\n    \"\"\"\n    datestamp = arrow.get(target_datetime).to('Asia/Tokyo').strftime('%Y%m%d')\n    consumption_url = {\n        'JP-HKD': 'http://denkiyoho.hepco.co.jp/area/data/juyo_01_{}.csv'.format(datestamp),\n        'JP-TH': 'http://setsuden.tohoku-epco.co.jp/common/demand/juyo_02_{}.csv'.format(datestamp),\n        'JP-TK': 'http://www.tepco.co.jp/forecast/html/images/juyo-j.csv',\n        'JP-HR': 'http://www.rikuden.co.jp/denki-yoho/csv/juyo_05_{}.csv'.format(datestamp),\n        'JP-CB': 'http://denki-yoho.chuden.jp/denki_yoho_content_data/juyo_cepco003.csv',\n        'JP-KN': 'http://www.kepco.co.jp/yamasou/juyo1_kansai.csv',\n        'JP-CG': 'http://www.energia.co.jp/jukyuu/sys/juyo_07_{}.csv'.format(datestamp),\n        'JP-SK': 'http://www.yonden.co.jp/denkiyoho/juyo_shikoku.csv'\n        }\n    # First roughly 40 rows of the consumption files have hourly data,\n    # the parser skips to the rows with 5-min actual values \n    if zone_key == 'JP-KN':\n        startrow = 44\n    else:\n        startrow = 42\n    df = pd.read_csv(consumption_url[zone_key], skiprows=list(range(startrow)),\n                     encoding='shift-jis')\n    df.columns = ['Date', 'Time', 'cons']\n    # Convert \u4e07kW to MW\n    df['cons'] = 10*df['cons']\n    df = df.dropna()\n    df['datetime'] = df.apply(parse_dt, axis=1)\n    df = df[['datetime', 'cons']]\n    return df\n\n\ndef fetch_price(zone_key='JP-TK', session=None, target_datetime=None,\n                logger=logging.getLogger(__name__)):\n    if target_datetime is None:\n        target_datetime = dt.datetime.now() + dt.timedelta(days=1)\n\n    # price files contain data for fiscal year and not calendar year.\n    if target_datetime.month <= 3:\n        fiscal_year = target_datetime.year - 1\n    else:\n        fiscal_year = target_datetime.year\n    url = 'http://www.jepx.org/market/excel/spot_{}.csv'.format(fiscal_year)\n    df = pd.read_csv(url)\n\n    df = df.iloc[:, [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14]]\n    df.columns = ['Date', 'Period', 'JP-HKD', 'JP-TH', 'JP-TK', 'JP-CB',\n                  'JP-HR', 'JP-KN', 'JP-CG', 'JP-SK', 'JP-KY']\n\n    if zone_key not in df.columns[2:]:\n        return []\n\n    start = target_datetime - dt.timedelta(days=1)\n    df['Date'] = df['Date'].apply(lambda x: dt.datetime.strptime(x, '%Y/%m/%d'))\n    df = df[(df['Date'] >= start.date()) & (df['Date'] <= target_datetime.date())]\n\n    df['datetime'] = df.apply(lambda row: arrow.get(row['Date']).shift(\n        minutes=30 * (row['Period'] - 1)).replace(tzinfo='Asia/Tokyo'), axis=1)\n\n    data = list()\n    for row in df.iterrows():\n        data.append({\n            'zoneKey': zone_key,\n            'currency': 'JPY',\n            'datetime': row[1]['datetime'].datetime,\n            'price': row[1][zone_key],\n            'source': 'jepx.org'\n        })\n\n    return data\n\n\ndef parse_dt(row):\n    \"\"\"\n    Parses timestamps from date and time\n    \"\"\"\n    return arrow.get(' '.join([row['Date'], row['Time']]).replace('/', '-'),\n                     'YYYY-M-D H:mm').replace(tzinfo='Asia/Tokyo').datetime\n\n\nif __name__ == '__main__':\n    \"\"\"Main method, never used by the Electricity Map backend, but handy for testing.\"\"\"\n\n    print('fetch_production() ->')\n    print(fetch_production())\n    print('fetch_price() ->')\n    print(fetch_price())\n", "path": "parsers/JP.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# coding=utf-8\nimport logging\n# The arrow library is used to handle datetimes\nimport arrow\nimport datetime as dt\nimport pandas as pd\nfrom . import occtonet\n\n# Abbreviations\n# JP-HKD : Hokkaido\n# JP-TH  : Tohoku\n# JP-TK  : Tokyo area\n# JP-CB  : Chubu\n# JP-HR  : Hokuriku\n# JP-KN  : Kansai\n# JP-SK  : Shikoku\n# JP-KY  : Kyushu\n# JP-ON  : Okinawa\n# JP-CG  : Ch\u016bgoku\n\n\ndef fetch_production(zone_key='JP-TK', session=None, target_datetime=None,\n                     logger=logging.getLogger(__name__)):\n    \"\"\"\n    Calculates production from consumption and imports for a given area\n    All production is mapped to unknown\n    \"\"\"\n    if target_datetime:\n        raise NotImplementedError(\n            'This parser is not yet able to parse past dates')\n    exch_map = {\n        'JP-HKD':['JP-TH'],\n        'JP-TH':['JP-TK'],\n        'JP-TK':['JP-TH', 'JP-CB'],\n        'JP-CB':['JP-TK', 'JP-HR', 'JP-KN'],\n        'JP-HR':['JP-CB', 'JP-KN'],\n        'JP-KN':['JP-CB', 'JP-HR', 'JP-SK', 'JP-CG'],\n        'JP-SK':['JP-KN', 'JP-CG'],\n        'JP-CG':['JP-KN', 'JP-SK', 'JP-KY']\n        }\n    df = fetch_consumption_df(zone_key, target_datetime)\n    df['imports'] = 0\n    for zone in exch_map[zone_key]:\n        df2 = occtonet.fetch_exchange(zone_key, zone, target_datetime)\n        df2 = pd.DataFrame(df2)\n        exchname = df2.loc[0, 'sortedZoneKeys']\n        df2 = df2[['datetime', 'netFlow']]\n        df2.columns = ['datetime', exchname]\n        df = pd.merge(df, df2, how='inner', on='datetime')\n        if exchname.split('->')[-1] == zone_key:\n            df['imports'] = df['imports']+df[exchname]\n        else:\n            df['imports'] = df['imports']-df[exchname]\n    df['prod'] = df['cons']-df['imports']\n    df = df[['datetime', 'prod']]\n    # add a row to production for each entry in the dictionary:\n    sources = {\n        'JP-HKD':'denkiyoho.hepco.co.jp',\n        'JP-TH':'setsuden.tohoku-epco.co.jp',\n        'JP-TK':'www.tepco.co.jp',\n        'JP-CB':'denki-yoho.chuden.jp',\n        'JP-HR':'www.rikuden.co.jp/denki-yoho',\n        'JP-KN':'www.kepco.co.jp',\n        'JP-SK':'www.energia.co.jp',\n        'JP-CG':'www.yonden.co.jp'\n        }\n    datalist = []\n    for i in range(df.shape[0]):\n        data = {\n            'zoneKey': zone_key,\n            'datetime': df.loc[i, 'datetime'].to_pydatetime(),\n            'production': {\n                'biomass': None,\n                'coal': None,\n                'gas': None,\n                'hydro': None,\n                'nuclear': None,\n                'oil': None,\n                'solar': None,\n                'wind': None,\n                'geothermal': None,\n                'unknown': df.loc[i, 'prod']\n            },\n            'storage': {},\n            'source': ['occtonet.or.jp', sources[zone_key]]\n            }\n        datalist.append(data)\n    return datalist\n\n\ndef fetch_consumption_df(zone_key='JP-TK', target_datetime=None,\n                      logger=logging.getLogger(__name__)):\n    \"\"\"\n    Returns the consumption for an area as a pandas DataFrame\n    \"\"\"\n    datestamp = arrow.get(target_datetime).to('Asia/Tokyo').strftime('%Y%m%d')\n    consumption_url = {\n        'JP-HKD': 'http://denkiyoho.hepco.co.jp/area/data/juyo_01_{}.csv'.format(datestamp),\n        'JP-TH': 'http://setsuden.tohoku-epco.co.jp/common/demand/juyo_02_{}.csv'.format(datestamp),\n        'JP-TK': 'http://www.tepco.co.jp/forecast/html/images/juyo-j.csv',\n        'JP-HR': 'http://www.rikuden.co.jp/denki-yoho/csv/juyo_05_{}.csv'.format(datestamp),\n        'JP-CB': 'http://denki-yoho.chuden.jp/denki_yoho_content_data/juyo_cepco003.csv',\n        'JP-KN': 'http://www.kepco.co.jp/yamasou/juyo1_kansai.csv',\n        'JP-CG': 'http://www.energia.co.jp/jukyuu/sys/juyo_07_{}.csv'.format(datestamp),\n        'JP-SK': 'http://www.yonden.co.jp/denkiyoho/juyo_shikoku.csv'\n        }\n    # First roughly 40 rows of the consumption files have hourly data,\n    # the parser skips to the rows with 5-min actual values \n    if zone_key == 'JP-KN':\n        startrow = 44\n    else:\n        startrow = 42\n    df = pd.read_csv(consumption_url[zone_key], skiprows=list(range(startrow)),\n                     encoding='shift-jis')\n    df.columns = ['Date', 'Time', 'cons']\n    # Convert \u4e07kW to MW\n    df['cons'] = 10*df['cons']\n    df = df.dropna()\n    df['datetime'] = df.apply(parse_dt, axis=1)\n    df = df[['datetime', 'cons']]\n    return df\n\n\ndef fetch_price(zone_key='JP-TK', session=None, target_datetime=None,\n                logger=logging.getLogger(__name__)):\n    if target_datetime is None:\n        target_datetime = dt.datetime.now() + dt.timedelta(days=1)\n\n    # price files contain data for fiscal year and not calendar year.\n    if target_datetime.month <= 3:\n        fiscal_year = target_datetime.year - 1\n    else:\n        fiscal_year = target_datetime.year\n    url = 'http://www.jepx.org/market/excel/spot_{}.csv'.format(fiscal_year)\n    df = pd.read_csv(url, encoding='shift-jis')\n\n    df = df.iloc[:, [0, 1, 6, 7, 8, 9, 10, 11, 12, 13, 14]]\n    df.columns = ['Date', 'Period', 'JP-HKD', 'JP-TH', 'JP-TK', 'JP-CB',\n                  'JP-HR', 'JP-KN', 'JP-CG', 'JP-SK', 'JP-KY']\n\n    if zone_key not in df.columns[2:]:\n        return []\n\n    start = target_datetime - dt.timedelta(days=1)\n    df['Date'] = df['Date'].apply(lambda x: dt.datetime.strptime(x, '%Y/%m/%d'))\n    df = df[(df['Date'] >= start.date()) & (df['Date'] <= target_datetime.date())]\n\n    df['datetime'] = df.apply(lambda row: arrow.get(row['Date']).shift(\n        minutes=30 * (row['Period'] - 1)).replace(tzinfo='Asia/Tokyo'), axis=1)\n\n    data = list()\n    for row in df.iterrows():\n        data.append({\n            'zoneKey': zone_key,\n            'currency': 'JPY',\n            'datetime': row[1]['datetime'].datetime,\n            'price': row[1][zone_key],\n            'source': 'jepx.org'\n        })\n\n    return data\n\n\ndef parse_dt(row):\n    \"\"\"\n    Parses timestamps from date and time\n    \"\"\"\n    return arrow.get(' '.join([row['Date'], row['Time']]).replace('/', '-'),\n                     'YYYY-M-D H:mm').replace(tzinfo='Asia/Tokyo').datetime\n\n\nif __name__ == '__main__':\n    \"\"\"Main method, never used by the Electricity Map backend, but handy for testing.\"\"\"\n\n    print('fetch_production() ->')\n    print(fetch_production())\n    print('fetch_price() ->')\n    print(fetch_price())\n", "path": "parsers/JP.py"}]}