Skip to content

Tag: pandas

Calling an R package function with rpy2

I’m new to R and need to pass string data from a pandas dataframe to a function in R. This function accepts nested lists of strings, such as: The code I tried two approaches: 1) That yielded KeyError: <class ‘list’> error message. 2) That yielded the error message: I checked if d is a …

AttributeError when applying map() for formatting

Hoping someone can advise on the AttributeError I’m receiving, as I’m not sure what is wrong with the way my code is written. I’ve seen other posts dealing with “‘DataFrame’ object has no attribute”, but it wasn’t applicable to this scenario. Using Python’…

Merge two dataframes with subheaders

So I have my first dataframe that has countries as headers and infected and death values as subheaders, then I have my second dataframe, I want to merge the dataframes so that the indicator columns become subheaders of the countries column like in df with the infected and dead subheaders. What I want to produ…