You’re analyzing monthly sales numbers in a simple Python script. You start with a small list of sales figures and, as new orders come in, you need to keep adding those numbers. If you don’t know how to append to array in Python, you end up creating new variables every time or manually editing the list, slow and error-prone.
In Python, you often use a list as a flexible “array-like” container for values such as monthly sales figures. In data-heavy work (for example, when you load CSV files or run analytics), you might also use a NumPy array for fast numeric operations. In both cases, you need a clean way to add new data points every time fresh numbers arrive, for example, appending next month’s sales or combining sales from two regions.
Imagine you’re tracking monthly sales for an online store in a list like [1200, 1350, 1600, 1450] and every new month you want to add another sales number. In this article, I’ll show you 5 ways to do how to append to an array in Python.
Dataset used in all methods
To keep things simple and real-world, I’ll use the same dataset in every example:
- Dataset: Monthly sales in dollars for one store
- Variable: sales
- Initial value: [1200, 1350, 1600, 1450]
You can imagine each number as sales for January to April. You’ll append data for later months using different methods.
Method 1 – Use list.append() (Single Value)
Use this method when you want to add one new value at the end of a list and you don’t want any extra libraries. It works great for simple scripts and small datasets.
Step 1: Start with a list of monthly sales
import sys # not required for append, but included so you can add future logic
sales = [1200, 1350, 1600, 1450]
print("Initial sales:", sales)
# Sample output:
# Initial sales: [1200, 1350, 1600, 1450]
You can see the output in the screenshot below.

How does this code work?
You create a normal Python list called sales with four monthly sales values, then print it so you can see the starting point.
Step 2: Append a single new month using list.append()
import sys # again, safe to copy-paste for larger scripts
sales = [1200, 1350, 1600, 1450]
new_month_sales = 1700
sales.append(new_month_sales)
print("After appending one month:", sales)
# Sample output:
# After appending one month: [1200, 1350, 1600, 1450, 1700]
How does this code work?
You create a Python variable new_month_sales with the latest month’s value (1700). Then you call sales.append(new_month_sales), which adds that value to the end of the list. The list.append() function always adds exactly one item and modifies the list in place.
Pro Tip: Use list.append() when you only need to add one new data point at a time (like a single month of sales) and you care about keeping memory usage simple and predictable.
Method 2 – Use list.extend() (Multiple Values)
Use this method if you want to append multiple values in one go — for example, when you get sales data for several new months and want to add them all at once. This is still pure Python, no external libraries needed.
Step 1: Prepare your base list and new sales
import sys
sales = [1200, 1350, 1600, 1450]
new_sales = [1700, 1800, 1900] # sales for May, June, July
print("Base sales:", sales)
print("New sales to add:", new_sales)
# Sample output:
# Base sales: [1200, 1350, 1600, 1450]
# New sales to add: [1700, 1800, 1900]
You can see the output in the screenshot below.

How does this code work?
You define sales as the existing monthly sales and new_sales as a list of upcoming months you want to add. Printing both helps you see what you’re combining.
Step 2: Extend the list with multiple values
import sys
sales = [1200, 1350, 1600, 1450]
new_sales = [1700, 1800, 1900]
sales.extend(new_sales)
print("After extending with multiple months:", sales)
# Sample output:
# After extending with multiple months: [1200, 1350, 1600, 1450, 1700, 1800, 1900]
How does this code work?
The list.extend() function takes an iterable (like another list) and adds each element of that iterable to the end of your list. Here, new_sales contains three values, and sales.extend(new_sales) appends them one by one to the sales list.
Pro Tip: Use list.extend() when you already have a list (or another iterable) of values — for example, new sales pulled from a CSV file — and want all of them added to your main list in a single step. This is more efficient and cleaner than calling append() in a loop.
Method 3 – Use + operator (Concatenate Lists)
This method is useful when you want to keep the original list unchanged and create a new list that includes both the old and new values. It’s handy for “what-if” analysis or when you don’t want to mutate your original data.
Step 1: Create original and new sales lists
import sys
sales = [1200, 1350, 1600, 1450]
new_sales_forecast = [2000, 2100] # forecasted sales for next two months
print("Current sales:", sales)
print("Forecasted sales:", new_sales_forecast)
# Sample output:
# Current sales: [1200, 1350, 1600, 1450]
# Forecasted sales: [2000, 2100]
You can see the output in the screenshot below.

How does this code work?
You define sales as today’s actual numbers and new_sales_forecast as predicted values for the next months. You’ll combine them without altering the original sales list.
Step 2: Concatenate lists with the + operator
import sys
sales = [1200, 1350, 1600, 1450]
new_sales_forecast = [2000, 2100]
combined_sales = sales + new_sales_forecast
print("Combined sales (actual + forecast):", combined_sales)
print("Original sales still unchanged:", sales)
# Sample output:
# Combined sales (actual + forecast): [1200, 1350, 1600, 1450, 2000, 2100]
# Original sales still unchanged: [1200, 1350, 1600, 1450]
How does this code work?
The + operator creates a new list by joining the elements of sales and new_sales_forecast. You store the result in combined_sales, so you can compare or analyze it separately. The original sales list stays the same.
Pro Tip: Use list concatenation with + when you want a separate result list for reporting or testing scenarios — for example, combining actual sales with forecasted sales while still keeping both sets of data intact.
Method 4 – Use NumPy append() for Numeric Arrays
Use this method when you work with large numeric datasets or need fast math operations. The NumPy library provides ndarray objects (numeric arrays) and a numpy.append() function that returns a new array with the appended values.
Step 1: Install and import NumPy, create a NumPy array
import numpy as np
sales = np.array([1200, 1350, 1600, 1450])
print("Initial NumPy sales array:", sales)
# Sample output:
# Initial NumPy sales array: [1200 1350 1600 1450]
How does this code work?
You import the NumPy library as np, then create a NumPy array called sales from a Python list of sales. Printing it shows the array format, which is different from a standard list but stores the same values.
Step 2: Append values using numpy.append()
import numpy as np
sales = np.array([1200, 1350, 1600, 1450])
new_sales = np.array([1700, 1800]) # two new months of sales
updated_sales = np.append(sales, new_sales)
print("Updated NumPy sales array:", updated_sales)
print("Original NumPy sales array still unchanged:", sales)
# Sample output:
# Updated NumPy sales array: [1200 1350 1600 1450 1700 1800]
# Original NumPy sales array still unchanged: [1200 1350 1600 1450]
How does this code work?
The numpy.append() function takes an existing NumPy array (sales) and another array or list (new_sales) and returns a new array that contains all values. Here, updated_sales has both the original four months and the two new months, while sales stays unchanged.
Pro Tip: Use numpy.append() when you’re already working with NumPy arrays in a data analysis or machine learning script. For very large datasets, consider pre-allocating arrays or using other NumPy stacking functions (like numpy.concatenate()) for better performance.
Method 5 – Use pandas Series.append() / concat for Time Series
Use this method when your data is time-based (like monthly sales) and you want extra features, such as indexes, dates, and easy exporting to CSV. The pandas library is built for tabular data and works well with Series (one-dimensional labeled arrays).
Step 1: Import pandas and create a Series of monthly sales
import pandas as pd
sales = pd.Series([1200, 1350, 1600, 1450],
index=["Jan", "Feb", "Mar", "Apr"])
print("Initial sales Series:")
print(sales)
# Sample output:
# Initial sales Series:
# Jan 1200
# Feb 1350
# Mar 1600
# Apr 1450
# dtype: int64
How does this code work?
You import the pandas library as pd and create a Series named sales. The index parameter gives each value a label (month name), which makes reports and plots easier to read.
Step 2: Append new months using pandas.concat()
import pandas as pd
sales = pd.Series([1200, 1350, 1600, 1450],
index=["Jan", "Feb", "Mar", "Apr"])
new_sales = pd.Series([1700, 1800],
index=["May", "Jun"])
updated_sales = pd.concat([sales, new_sales])
print("Updated sales Series:")
print(updated_sales)
# Sample output:
# Updated sales Series:
# Jan 1200
# Feb 1350
# Mar 1600
# Apr 1450
# May 1700
# Jun 1800
# dtype: int64
How does this code work?
You create another Series called new_sales with the sales values for May and June. Then you use pd.concat([sales, new_sales]) to join both Series into a new one, updated_sales, which has all months from January to June.
Pro Tip: Use pandas Series (and pandas.concat()) when you need labels, indexes, and integration with CSV/Excel files. This is perfect for reporting scripts where you want to append new monthly data and then save the full time series.
Things to Keep in Mind
- Lists vs “real” arrays. In everyday Python, you usually use a list as your “array”. If you need numeric speed and advanced math, switch to NumPy arrays or pandas.
- Mutating vs creating new. Functions like list.append() and list.extend() change the original list. Operators like + and functions like numpy.append() or pandas.concat() create new objects.
- Data types must match. When you use numpy.append() or pandas.concat(), make sure values have compatible data types (for example, mixing strings and integers in numeric arrays can cause type changes you don’t expect).
- Avoid growing large arrays in tight loops. Repeated use of append() on huge datasets can be slow. For large-scale work, try pre-sizing structures or using list comprehension to build lists in one go.
- Empty lists and arrays. Always initialize your container clearly. Starting with sales = [] or np.array([]) is fine, but remember that the first appended values may set or influence the overall data type.
- Library imports and environment. Make sure you have NumPy and pandas installed before using them (
pip install numpy pandas), and always include import numpy as np or import pandas as pd at the top of your Python script.
You’ve seen five practical ways to append to array in Python using lists, NumPy arrays, and pandas Series, all with the same monthly sales example. Use list.append() for simple scripts, list.extend() or + when working with plain lists, and NumPy or pandas when you need powerful numeric or time-series features. I hope you found this article helpful.
You may also like to read:
- Python Program to Print the Number of Elements Present in an Array
- Concatenation of Arrays in Python
- Python Write Array to CSV
- Python: Repeat an Array n Times

Bijay Kumar is an experienced Python and AI professional who enjoys helping developers learn modern technologies through practical tutorials and examples. His expertise includes Python development, Machine Learning, Artificial Intelligence, automation, and data analysis using libraries like Pandas, NumPy, TensorFlow, Matplotlib, SciPy, and Scikit-Learn. At PythonGuides.com, he shares in-depth guides designed for both beginners and experienced developers. More about us.