create new columns pandas from another column

Solutions on MaxInterview for create new columns pandas from another column by the best coders in the world

showing results for - "create new columns pandas from another column"
Sebastián
01 Feb 2019
1def label_race (row):
2   if row['eri_hispanic'] == 1 :
3      return 'Hispanic'
4   if row['eri_afr_amer'] + row['eri_asian'] + row['eri_hawaiian'] + row['eri_nat_amer'] + row['eri_white'] > 1 :
5      return 'Two Or More'
6   if row['eri_nat_amer'] == 1 :
7      return 'A/I AK Native'
8   if row['eri_asian'] == 1:
9      return 'Asian'
10   if row['eri_afr_amer']  == 1:
11      return 'Black/AA'
12   if row['eri_hawaiian'] == 1:
13      return 'Haw/Pac Isl.'
14   if row['eri_white'] == 1:
15      return 'White'
16   return 'Other'
17
18df.apply(lambda row: label_race(row), axis=1)
queries leading to this page
how to create a new column in dataframe using other columnscreate new column pandas from other columnspython if 2 columns meet criteria create column valuepython create new dataframe columns using othercreate dataframe column from other columnsdataframe new column based on other columnshow to add a new column from other columns in pandasadd new column if value in other column is the samehow to create new column in dataframe based on other copandas add column from another columncreate new columns in pandas efficientlypandas new column function of other columnspython add columns according to column valuespandas create new column applycreate dataframe with columns for other dataframecreate new column from text in another columns pandaspandas dataframe create a column based on the value of another columnpandas new column based on other columnspopulate a columns of a dataframe from another dataframe in pythoncreate new column in dataframe using other columnsapply but add new columnscreate one column from a dataframemake new column based on other columns pandaspython create new column based on other columnspandas create a column based on another columnpandas create column from function with other columns as parametersif column has name make another coulmn 0 pandaspandas create new column from existing and alter stringcreate new pandas column by running function over other columnpandas column based on another columnhow to create new columns from data within our column pandaspandas create columns from other columnspandas create new column based on operation of other columnspython make a new df column that 27s an edit of another df columncreate a column base on other columnspandas dataframe create new column based on other columnscreate a new column based on another columns in pandaspandas new columns from other columnsnew column from other columns pandaspandas new column from other columnscreate new column if two columns 3d 1 pandascreate dataframe from another dataframe columnpandas create column from other columncreate new columns pandas from another columncreate a dataframe with columns from another dataframepandas create new column based on other columns in listdataframe add a column based on other columnspython create a new column based on another columnpandas create new column based on values from other columnsadd df column with df apply valuespandas making new dataframe using other columnscreate column from other columns pandaspandas add column based on another columncreate pandas column from other columnpython pandas create new column based on other columnshow to column for each row based on other columns in pandaspandas add column as function of another columnpandas new column based on another columncreate new column pandas based on other columnscreate dataframe using columns of another dataframecreate new columns from a given column pandaspandas add column based on other columnscreate a new column based on another column pandas in a differnet tablepandas calculate column based on otherpandas create new column based on other dataframecreate new pandas column by function of othercreate a new dataframe with selected columns from another dfpd create column from anotherdataframe create data and column from other columnsdefine a new column formula from other columns pandascreate dataframe from other columns pythoncreate a new column based on other columns pandaspandas create new columns based on other columnspandas new column based on other columntcrate a new column in pandas based on other columns in dfdataframe create column from other columnspandas create column from another dataframe column valuehow to create new column in panda inside functioncreate new column in pandas dataframe based on other columnshow to create a new column based on other columns in pandaspandas add column with value from another columncreate a new column based on another pandaspandas create new column based on another columnif a df column value is same for both rows then create a new columncreate a new column in pandas based on previous columnpandas create new column from another columnpandas dataframe new df with certain columns from another dataframecreate new dataframe with some columnshow to generate a column using another columns in csvpandas create new column in place 3dtruecreate new column based on other columns pandasdataframe add multiple columns based on other columnscreate a new column in pandas based on other columns condetioncreate df with only columnspandas create dataframe with columns from anotherhow to add a column based on another column pandashot to create a new dataframe with some columns of other dataframeadd a new column to a dataframe based on other columnspandas create new column based on other columnspandas caclulate column based on other columnshow to make one column from other columns in pandascreate new column in pandas based on other columnspython create a df using columns from another dfpython add column based on another columnpython pandas new column based on other columnsget a column based on other columns in pythoncreate new dataframe from columns of other dataframepandas make new column based on another columnhow to create a new column in pandas based on another columnhow to create a new column based on another column pandaspandas generate column from other columnscreate a new dataframe from another df columnsin pandas how to create new column based on the value of another columncreate a new column in pandas based on other columnscreate new column from other columns of dataframe how to make a new dataframe with columns from anotherhow to create new columns from another columns in pandaspython create a column as function of othercreate a new column from existing columns pandas while applying a functionpandas create a new column based on another columncreate dataframe from columns of another dataframecreate a new column in df with values of another columncreate column from other column pandaspython create new column add other columns valuespython create a column with values from other columnscreate new column based on another pandasadd column to pandas dataframe based on value in columnsadd new column and acess other columnhow to create a new column in pandas based on the values of another columncreate a new df from columns of another dfpandas create dataframe with columns from another dataframecreate a new column from other dataframecreate new column in dataframe using calculations on other columnscreate new column in dataframe python based on other columnshow to add columns in pandas using a common column in another dataframecreate a new column in pandas based on other columns distributionpandas create column based on other columnscreate a new column based on another column pandaspandas add columns from another dataframedataframe create new column from other columnscreate new column pandas based on other columnpandas create column from another columnhow to create a new column from others pandaspanda dataframe new column based on otherscalculate column out of two other columns pandaspython new column znorm other columnpandas assign column from another dataframecreate new dataframe with columns from another dataframe pythoncreate new dataframe with another dataframe columnshow to create a column in pandas dataframe after another columncreate new columns pandas from another column