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

'DataFrame' object has no attribute 'concat' #8

Open
FilipeDoria opened this issue Jun 12, 2024 · 7 comments
Open

'DataFrame' object has no attribute 'concat' #8

FilipeDoria opened this issue Jun 12, 2024 · 7 comments

Comments

@FilipeDoria
Copy link

Hey!
I just tried using the package, unsuccessfully. Maybe something changed within OMIE endpoints?
I tried the example code you suggested:

`import datetime as dt
import matplotlib.pyplot as plt

from OMIEData.DataImport.omie_marginalprice_importer import OMIEMarginalPriceFileImporter
from OMIEData.Enums.all_enums import DataTypeInMarginalPriceFile

dateIni = dt.datetime(2024, 1, 1)
dateEnd = dt.datetime(2024, 3, 22)

df = OMIEMarginalPriceFileImporter(date_ini=dateIni, date_end=dateEnd).read_to_dataframe(verbose=True)
df.sort_values(by='DATE', axis=0, inplace=True)
print(df)
`

And got this error:
'DataFrame' object has no attribute 'concat'https://www.omie.es/sites/default/files/dados/AGNO_2024/MES_01/TXT/INT_PBC_EV_H_1_15_01_2024_15_01_2024.TXT
Requesting https://www.omie.es/sites/default/files/dados/AGNO_2024/MES_01/TXT/INT_PBC_EV_H_1_16_01_2024_16_01_2024.TXT ...
There was error processing file: https://www.omie.es/sites/default/files/dados/AGNO_2024/MES_01/TXT/INT_PBC_EV_H_1_16_01_2024_16_01_2024.TXT

Can you have a look at it?

@acruzgarcia
Copy link
Owner

Hi, sorry i didnt ser this issue until now!

Please update the pandas package. The version has to be > 2.0.1

@javier-alvarez-ctic
Copy link

javier-alvarez-ctic commented Sep 12, 2024

Hi, I have the Pandas Version 2.2.2 installed and I have the same issue.

I tried to downgrade the version and use version 2.0.1 or 2.0.2 (thats require downgrade Numpy too) but I have the same issue (Im using Python 3.11.3)

This package still working? I need to download data from OMIE (energy prices from Spain)

Thanks!!

(.venv) PS XXXXXXXXX> python .\Omie.py 2.0.2 Requesting https://www.omie.es/sites/default/files/dados/AGNO_2020/MES_01/TXT/INT_PBC_EV_H_1_01_01_2020_01_01_2020.TXT ... There was error processing file: https://www.omie.es/sites/default/files/dados/AGNO_2020/MES_01/TXT/INT_PBC_EV_H_1_01_01_2020_01_01_2020.TXT 'DataFrame' object has no attribute 'concat'https://www.omie.es/sites/default/files/dados/AGNO_2020/MES_01/TXT/INT_PBC_EV_H_1_01_01_2020_01_01_2020.TXT Requesting https://www.omie.es/sites/default/files/dados/AGNO_2020/MES_01/TXT/INT_PBC_EV_H_1_02_01_2020_02_01_2020.TXT ... There was error processing file: https://www.omie.es/sites/default/files/dados/AGNO_2020/MES_01/TXT/INT_PBC_EV_H_1_02_01_2020_02_01_2020.TXT 'DataFrame' object has no attribute 'concat'https://www.omie.es/sites/default/files/dados/AGNO_2020/MES_01/TXT/INT_PBC_EV_H_1_02_01_2020_02_01_2020.TXT Empty DataFrame Columns: [DATE, CONCEPT, H1, H2, H3, H4, H5, H6, H7, H8, H9, H10, H11, H12, H13, H14, H15, H16, H17, H18, H19, H20, H21, H22, H23, H24] Index: []

@javier-alvarez-ctic
Copy link

javier-alvarez-ctic commented Sep 12, 2024

Hi again!

You only need to change the OMIEData/DataImport/omie_data_importer_from_responses.py code from:
df = df.concat([df, self.fileReader.get_data_from_response(response=response)], ignore_index=True)
To this:
df = pd.concat([df, self.fileReader.get_data_from_response(response=response)],ignore_index=True)

I have created a new Pull request, please accept it if is ok with you.

Thanks!

@acruzgarcia
Copy link
Owner

Hi, this is a recurrent issue that has been replied before. You need to update pandas package to be a version higher or equal to 2.0.1.

Please pip install pandas.
Thanks

@javier-alvarez-ctic
Copy link

Hi. As I said in my first message, I do actually have Pandas installed in my environment...

In fact, I have a version higher than 2.0.1, exactly version 2.2.2. I have tried to downgrade the version to 2.0.1 and 2.0.2 (the same and a little higher) and the problem persists.

I made the change I said in my second message and everything works now, please keep this in mind.

Thank you.

@acruzgarcia
Copy link
Owner

Yes, thanks for this. Your fix looks like the correct one. The current code must have been corrupted in the last update. I will fix when I have some spare time.

Sorry for the initial confusion. I did not correctly read your message.

Cheers,
Alberto.

@acruzgarcia
Copy link
Owner

In fact I have just seen that you did a pull request so I will review ASAP. Thanks!

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

3 participants