Python Forum
pandas best way to add a new row in a already existing dataframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
pandas best way to add a new row in a already existing dataframe
#1
hello,

i have a dataframe and i would like to add a new row to it.
i am quite confused about which is the best way to do it:
I could manage the row to be what i want list, dict, series, dataframe
all is possible but which is the best way?

to my understanding making a dataframe from a dict (and then add it) should be the most favorite

while i am here i have also another doubt about this already working code
test = web_scraping.quote(i)
page = pd.DataFrame.from_dict(test, orient='index').T
df = df.append(page)
something says me that the transpose ".T" i am doing isn't necessary if i pass the dict in the right way, but how?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Solved] Formatting cells of a pandas dataframe into an OpenDocument ods spreadsheet Calab 1 666 Mar-01-2025, 04:51 AM
Last Post: Calab
  Find duplicates in a pandas dataframe list column on other rows Calab 2 2,173 Sep-18-2024, 07:38 PM
Last Post: Calab
  Find strings by index from a list of indexes in a different Pandas dataframe column Calab 3 1,627 Aug-26-2024, 04:52 PM
Last Post: Calab
  Add NER output to pandas dataframe dg3000 0 1,152 Apr-22-2024, 08:14 PM
Last Post: dg3000
  Pandas keep existing format of Excel AlphaInc 2 10,767 Jan-11-2024, 03:44 AM
Last Post: plonkarchivist
  HTML Decoder pandas dataframe column mbrown009 3 2,683 Sep-29-2023, 05:56 PM
Last Post: deanhystad
  Use pandas to obtain cartesian product between a dataframe of int and equations? haihal 0 2,015 Jan-06-2023, 10:53 PM
Last Post: haihal
  Pandas Dataframe Filtering based on rows mvdlm 0 2,082 Apr-02-2022, 06:39 PM
Last Post: mvdlm
  Pandas dataframe: calculate metrics by year mcva 1 3,426 Mar-02-2022, 08:22 AM
Last Post: mcva
  Pandas dataframe comparing anto5 0 1,920 Jan-30-2022, 10:21 AM
Last Post: anto5

Forum Jump:

User Panel Messages

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