If I have an empty dataframe as such:
columns = ['Date', 'Name', 'Action','ID']
df = pd.DataFrame(columns=columns)
is there a way to append a new row to this newly created dataframe? Currently I have to create a dictionary, populate it, then append the dictionary to the dataframe at the end. Is there a more direct way?
Upcoming pandas 0.13 version will allow to add rows through loc
on non existing index data. However, be aware that under the hood, this creates a copy of the entire DataFrame so it is not an efficient operation.
Description is here and this new feature is called Setting With Enlargement.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments