Giter Site home page Giter Site logo

Comments (4)

FabianHofmann avatar FabianHofmann commented on June 3, 2024

Hey @ChinCity, it looks quiet good. I think you have to pull the convert_alpha2_to_country line to the top before the country filtering.

Or probably the line

        .loc[lambda df: df.Country.isin(config['target_countries'])]

can be deleted as the config_filter should take care of this.

from powerplantmatching.

ChinCity avatar ChinCity commented on June 3, 2024

Hey @FabianHofmann,

I tried both of those but I'm still getting an empty dataframe :/

from powerplantmatching.

FabianHofmann avatar FabianHofmann commented on June 3, 2024

Have you checked if your raw file is properly loaded? If yes, I would go step by step through the lines and check where the entries are dropped (atm it seems only the config filter could do so)

from powerplantmatching.

ChinCity avatar ChinCity commented on June 3, 2024

You are right that did it!

Final code:

config = get_config() if config is None else config

change_fueltype={'Fossil Gas': 'Natural Gas',
                 'Fossil Coal-derived gas': 'Natural Gas',
                 'Hydro Run-of-river and poundage': 'Hydro',
                 'Hydro Pumped Storage': 'Hydro',
                 'Hydro Water Reservoir': 'Hydro',
                    'Fossil Hard coal': 'Hard Coal',
                    'Fossil Hard Coal': 'Hard Coal',
                    'Fossil Brown coal/Lignite': 'Lignite',
                    'Fossil Oil': 'Oil',
                    'Fossil Oil shale': 'Oil',
                    'Wind Offshore': 'Wind',
                    'Wind Onshore': 'Wind',
                    'Biomass': 'Bioenergy',
                    'Fossil Peat': 'Bioenergy',
                    'Marine': 'Other'}

df = parse_if_not_stored('JRC_OPEN_update', update, config)
if raw:
    return df
df = (df.rename(columns={'eic_p': 'projectID',
                          'name_p': 'Name',
                          'capacity_p': 'Capacity',
                          'country': 'Country',
                          'type_g': 'Fueltype',
                          'lat': 'lat',
                          'lon': 'lon',
                          'year_commissioned':'YearCommissioned'})
   .loc[lambda df: df.Country.isin(config['target_countries'])]
    .replace(change_fueltype)
    .drop(columns = ['eic_g', 'name_g', 'capacity_g', 'NUTS2',
                     'status_g', 'year_decommissioned', 'type_g2'])
     .pipe(set_column_name, 'JRC_OPEN_update'))

return df

from powerplantmatching.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.