Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

marge 2 rows in same dataframe python

obj_df = df.select_dtypes(include=[np.object])
num_df = df.select_dtypes(exclude=[np.object])

obj_df.head(1).combine_first(obj_df.tail(1)).join(num_df.head(1).add(num_df.tail(1)))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #marge #rows #dataframe #python
ADD COMMENT
Topic
Name
9+2 =