Skip to content
  • View menu
  • View sidebar

bioinfo core

Index & solution of bioInfo utilities

  • Home
  • All entries
  • Blogs
  • Contact
  • About

Categories

  • Between languages (7)
  • Blogs (8)
  • Python (35)
  • R (1)
  • Unix (37)

Tags

bedfile Blogs conda Excel html numpy Pandas Python R slurm Unix
06/17/202206/17/2022 by bioinfocore

Python Pandas merge multiple row/column values into one row/column

  • Python
  • Pandas, Python

Merge multiple row or column values into one row or column:

df.loc[colSelected,].apply(lambda x: ';'.join(x.astype(str)), axis=0)
df.loc[,rowSelected].apply(lambda x: ';'.join(x.astype(str)), axis=1)

Source:
https://stackoverflow.com/questions/33098383/merge-multiple-column-values-into-one-column-in-python-pandas

Post navigation

← Previous Post Python matplotlib: all about fonts
Next Post → Pandas merge or sum values in rows with the same index
Copyright 2024 | by bioinfocore