How to copy the sub_newvalues? ....

Hi guys,
I've a little problem... How can I insert my one column in the main dataframe?? the number of rows are the same...

I think you need a comma before "subcategory".

This is python? But this is an R forum.

@woodward, yeah it's true is Python but in R there are Dataframes and follow the same logical thing!

I want to avoid the first category_code, for example:

  • there is ... I want to create a column named subcategory where there is only the subcategories.. in this case kitchen.washer!

Another example:

and so on...

sub_newvalues makes what I want to do! ... but while I'm making the merge with the main dataframe, the values are wrong!?

To add a column to a data frame in R? This is the simplest way

df$newcol <- new_col_vector

@woodward no is in pandas... and yes R doesn't have pandas

Edit: I solved my problem, thanks all

1 Like

I was just going to say, we are looking to increasingly support python questions, but likely questions that come from using python for data science with RStudio tools. For example, about reticulate and working with python in R Markdown docs. In future, you'd have greater success with a question like this on the Jupyter Forum or Stack Overflow with a python and pandas tag.