[Pandas] pd.concat()를 통해 DataFrame에 행 추가하기


환경

  • Python
  • Pandas


사용법

  • pd.concat() 사용
import pandas as pd

# create an existing DataFrame
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})

# create a new row as a DataFrame
new_row = pd.DataFrame({'A': [4], 'B': [7]})

# concatenate the existing DataFrame and the new row
df = pd.concat([df, new_row], ignore_index=True)

df


참고자료