Skip to content

Commit

Permalink
Merge pull request #110 from rachtsingh/main
Browse files Browse the repository at this point in the history
Small fixes to allow querying US data
  • Loading branch information
peterdudfield authored May 4, 2022
2 parents 3f59868 + 68bd33a commit 34bc5f2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pvoutput/mapscraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def _convert_energy_to_numeric_watt_hours(series: pd.Series) -> pd.Series:
for unit, multiplier in [("kWh", 1e3), ("MWh", 1e6)]:
selection = series[series.str.contains(unit)]
selection = selection.str.replace(unit, "")
selection = selection.str.replace(",", "")
selection = pd.to_numeric(selection)
selection *= multiplier
data.append(selection)
Expand Down Expand Up @@ -376,7 +377,7 @@ def get_regions_for_country(country_code: int):
region_tags = soup.find_all("a", href=re.compile(r"map\.jsp\?country="))
for row in region_tags:
href = row.attrs["href"]
p = re.compile(r"^map\.jsp\?country=243&region=(\w+.*)$")
p = re.compile(r"^map\.jsp\?country=" + str(country_code) + r"&region=(\w+.*)$")
href_match = p.match(href)
region = href_match.group(1)
region_list.append(region)
Expand Down

0 comments on commit 34bc5f2

Please sign in to comment.