Add data
Insert new columns, rows, or values into your dataset.
Example Data
Follow along with right out of the box example data. Copy following data in the information request of the agent you are working in.
Sometimes we don’t just analyze data — we expand it. You might want to add a new column for calculations, add rows for updated transactions, or correct a few specific cells.
In this section, we’ll learn how to insert new information into your table by column, row, or individual cell.
Add a new column
Excel
In Excel, you add a column by typing in a new header and filling values manually or using a formula.
t0 Prompt
Add a new column called "Secondary Currency"
Create a column called "Flag" and fill it with "Yes"
Insert column X into the table
Code
The python code looks as follows:
Add a calculated column
Excel
In Excel, you might create a formula like =Amount*0.05
to calculate VAT or similar metrics.
t0 Prompt
Add a column with 10% of the value in column X
Create a new column that is Amount divided by 1 million
Make a column and calculate 1.2 times column Amount
Code
The python code looks as follows:
Add a single row
Excel
In Excel, you insert a new row and manually type in values for each cell.
t0 Prompt
Add a new row for a transaction from Italy to Brazil
Insert a new row with today's date and 5 million in Amount column
Code
The python code looks as follows:
Update a single cell
Excel
In Excel, you double-click a cell and type in a new value.
t0 Prompt
Change the amount in row 2 to 8 million
Edit the date in the first row to 4.5.2025
Update a value in the table from X to Y
Code
The python code looks as follows:
Function | Description |
---|---|
df["New Column"] = value | Adds a new column |
df["Column"] = expression | Creates a calculated column |
pd.concat([df, new_row]) | Adds a row to the bottom |
df.at[row_index, "Column"] = x | Updates a single cell by row and column |