pandas dataframe add timestamp code example

Example 1: how to add a column to a pandas df

#using the insert function:
df.insert(location, column_name, list_of_values) 
#example
df.insert(0, 'new_column', ['a','b','c'])
#explanation:
#put "new_column" as first column of the dataframe
#and puts 'a','b' and 'c' as values

#using array-like access:
df['new_column_name'] = value

#df stands for dataframe

Example 2: add new row to dataframe pandas

# Add a new row at index k with values provided in list
dfObj.loc['k'] = ['Smriti', 26, 'Bangalore', 'India']