Append data to an empty Pandas DataFrame
Let us see how to append data to an empty Pandas DataFrame.
Creating the Data Frame and assigning the columns to it
On appending the float values to the int valued data type column the resultant data frame column type-caste into float in order to accommodate the float value
If we use the argument
ignore_index = True => that the index values will remain continuous instead of starting again from 0, be default it’s value is
When we appended the boolean format data into the data frame that was already of the type of float columns then it will change the values accordingly in order to accommodate the boolean values in the float data type domain only.
On appending the data of different data types to the previously formed Data Frame then the resultant Data Frame columns type will always be of the wider spectrum data type.
If we aim to create a data frame through a for loop then the most efficient way of doing that is as follows :
If we attempt to add different column than already in the data frame then results are as follows :