NumEconCopenhagen / IntroProg-lectures

Introductionary programming lectures
MIT License
30 stars 72 forks source link

Concatenating datasets results in a list #12

Closed gpl942 closed 1 year ago

gpl942 commented 1 year ago

Hi all I'm concatenating two dataframes: all = pd.concat([A,B])

I want to call some methods and functions on the new dataset, but I receive a error message saying that the new dataset is not a DataFrame anymore, but a list.

I called type function on the original datasets A and B and the result is: <class 'pandas.core.frame.DataFrame'> <class 'pandas.core.frame.DataFrame'>

If I call type function on the concatenated dataset the result is: <class 'list'>

If I call: all.shape i get: AttributeError: 'list' object has no attribute 'shape'`

Any idea why "concat" is transforming the dataset to a list (this was not happening in the lecture notebooks) is appreciated.

AskerNC commented 1 year ago

Hi I have no idea why this would happen, concat should return either a DataFrame or a pandas Series. Could you upload code that recreates the problem? Possibly just to your group repository then I can have a look. (In your latest commit I could not find the issue)

gpl942 commented 1 year ago

Hi I have no idea why this would happen, concat should return either a DataFrame or a pandas Series. Could you upload code that recreates the problem? Possibly just to your group repository then I can have a look. (In your latest commit I could not find the issue)

Hi Asker I checked the file again and I confirm that the issue isn't there anymore: the output is a DF and the method are working fine. I really don't know what was going on before. Sorry for the bother and thanks for the feedback.