Stack two Pandas series vertically and horizontally Improve Improve Like Article Like Save Share Report In this article we’ll see how we can stack two Pandas series both vertically and horizontally. We stack these lists to combine some data in a DataFrame for a better visualization of the data, combining different data, etc. Now let’s see with the help of examples how we can do this. Stacking Horizontally : We can stack 2 Pandas series horizontally by passing them in the pandas.concat() with the parameter axis = 1. Example : # importing the module import pandas as pd # creating the series series1 = pd.Series(['g', 'e', 'e', 'k', 's']) print("Series 1:") print(series1) series2 = pd.Series([9, 8, 7, 6, 5]) print("Series 2:") print(series2) # stacking the series horizontally df = pd.concat([series1, series2], axis = 1) print("\nStack two series horizontally:") display(df) Output : Stacking Vertically : We can stack 2 Pandas series vertically by passing them in the pandas.concat() with the parameter axis = 0. Example : # importing the module import pandas as pd # creating the series series1 = pd.Series(['g', 'e', 'e', 'k', 's']) print("Series 1:") print(series1) series2 = pd.Series([9, 8, 7, 6, 5]) print("Series 2:") print(series2) # stacking the series vertically df = pd.concat([series1, series2], axis = 0) print("\nStack two series vertically:") display(df) Output : Last Updated : 18 Aug, 2020 Like Article Save Article Previous Replace missing white spaces in a string with the least frequent character using Pandas Next Get list of column headers from a Pandas DataFrame Share your thoughts in the comments Add Your Comment Please Login to comment... Similar Reads How to flip an image horizontally or vertically in Python? Add a Pandas series to another Pandas series Pandas Series dt.weekofyear Method | Get Week of Year in Pandas Series Pandas Series dt.minute | Extract Minute from DateTime Series in Pandas Pandas Series dt.dayofweek | Get Day of Week from DateTime Series in Pandas Pandas Series dt.freq | Retrieve Frequency of Pandas Time Series Pandas Series dt.daysinmonth | Get Number of Days in Month in Pandas Series Pandas Series dt.normalize() | Normalize Time in Pandas Series Python | Pandas series.cumprod() to find Cumulative product of a Series Python | Pandas Series.str.replace() to replace text in a series Like P parasmadan15 Follow Article Tags : Python Pandas-exercise Python pandas-series Python-pandas Python Practice Tags : python