Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

year_limited: error on combining data frames with different column indices #113

Open
fleimgruber opened this issue May 28, 2021 · 1 comment

Comments

@fleimgruber
Copy link
Contributor

Reproducer:

def test_pv_germany():
    load_dotenv()
    API_KEY = os.getenv("ENTSOE_API_KEY")
    client = EntsoePandasClient(api_key=API_KEY)

    tz = "Europe/Berlin"

    start = pd.Timestamp("20180101", tz=tz)
    end = pd.Timestamp("20190102", tz=tz)

    country_code = "DE"

    df = client.query_generation(
        country_code, start=start, end=end, process_type="A16", psr_type="B16"
    )
    print(df.head())

The problematic statement is

df = pd.concat(frames, sort=True)

where it fails with the error

AttributeError: 'NoneType' object has no attribute 'is_extension'

because frames has two dataframes where column labels do not match

frames[0].columns
MultiIndex([('Solar',  'Actual Aggregated'),
            ('Solar', 'Actual Consumption')],
           )

frames[1].columns
Index(['Solar'], dtype='object')

Now this is tricky and I guess does not come up too often, but do you see an easy fix or did similar issues come up with other queries?

@fleimgruber fleimgruber changed the title year_limited: error on combining yearly data frames year_limited: error on combining data frames with different column indices May 28, 2021
@jpaduart
Copy link
Collaborator

jpaduart commented May 29, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants