Python Forum
[Solved:] How to use pd.append() ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved:] How to use pd.append() ?
#1
Can someone tell me, why the first example of how to use pd.append() works, and the second not?

# 1) This works fine: 

df1 = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
df2 = pd.DataFrame([[5, 6], [7, 8]], columns=list('AB'))
df1.append(df2)
df1

# 2) However this does not work:

d3 = {'1':[100],'pos':["middle"]}
d4 = {'1':[200],'pos':["middle"]}

df3 = pd.DataFrame(data=d3)
df4 = pd.DataFrame(data=d4)

df3.append(df4)
df3
I am using the 2nd way to create my dataframe, and prefer to combine my dataframes with

pd.append() 
instead of
pd.concat()
Reply


Messages In This Thread
[Solved:] How to use pd.append() ? - by ju21878436312 - Feb-28-2022, 12:15 PM
RE: How to use pd.append() ? - by snippsat - Feb-28-2022, 03:50 PM
RE: How to use pd.append() ? - by ju21878436312 - Mar-01-2022, 07:41 AM
RE: How to use pd.append() ? - by deanhystad - Feb-28-2022, 04:27 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] [Beautifulsoup] Find if element exists, and edit/append? Winfried 2 4,378 Sep-03-2022, 10:14 PM
Last Post: Winfried
  Cant Append a word in a line to a list err "str obj has no attribute append Sutsro 2 2,643 Apr-22-2020, 01:01 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020