Adding Columns to Pandas DataFrames
📰 Medium · Python
Link for non-members Continue reading on Medium »
Full Article
Title: Adding Columns to Pandas DataFrames
URL Source: https://giulio-laurenti.medium.com/adding-columns-to-pandas-dataframes-d4f587709d81?source=rss------python-5
Published Time: 2026-04-22T19:39:38Z
Markdown Content:
# Adding Columns to Pandas DataFrames | by Giulio Laurenti, PhD | Apr, 2026 | Medium
[Sitemap](https://giulio-laurenti.medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

Member-only story
# Adding Columns to Pandas DataFrames
[](https://giulio-laurenti.medium.com/?source=post_page---byline--d4f587709d81---------------------------------------)
[Giulio Laurenti, PhD](https://giulio-laurenti.medium.com/?source=post_page---byline--d4f587709d81---------------------------------------)
Follow
5 min read
·
1 hour ago
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2Fd4f587709d81&operation=register&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&user=Giulio+Laurenti%2C+PhD&userId=2489258d6569&source=---header_actions--d4f587709d81---------------------clap_footer------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2Fd4f587709d81&operation=register&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=---header_actions--d4f587709d81---------------------bookmark_footer------------------)
[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3Dd4f587709d81&operation=register&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=---header_actions--d4f587709d81---------------------post_audio_button------------------)
Share
Press enter or click to view image in full size

Photo by [Simone Dinoia](https://unsplash.com/@simonedna?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/photos/a-couple-of-pandas-that-are-sitting-in-a-tree-cKlloJkCPm0?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
[_Link for non-members_](https://giulio-laurenti.medium.com/adding-columns-to-pandas-dataframes-d4f587709d81?sk=458ecfff85fc163e49316e68f72926c6)
In a [previous post](https://medium.com/@giulio-laurenti/adding-rows-to-pandas-dataframes-2863e1cd0804), we learned to add rows to a DataFrame. Here, we will learn to add columns.
For this article, we will import both Pandas and Numpy.
import pandas as pd
import numpy as np
Create a Dictionary with students’ names and Math results, and from it cr
URL Source: https://giulio-laurenti.medium.com/adding-columns-to-pandas-dataframes-d4f587709d81?source=rss------python-5
Published Time: 2026-04-22T19:39:38Z
Markdown Content:
# Adding Columns to Pandas DataFrames | by Giulio Laurenti, PhD | Apr, 2026 | Medium
[Sitemap](https://giulio-laurenti.medium.com/sitemap/sitemap.xml)
[Open in app](https://play.google.com/store/apps/details?id=com.medium.reader&referrer=utm_source%3DmobileNavBar&source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)
[](https://medium.com/?source=post_page---top_nav_layout_nav-----------------------------------------)
Get app
[Write](https://medium.com/m/signin?operation=register&redirect=https%3A%2F%2Fmedium.com%2Fnew-story&source=---top_nav_layout_nav-----------------------new_post_topnav------------------)
[Search](https://medium.com/search?source=post_page---top_nav_layout_nav-----------------------------------------)
Sign up
[Sign in](https://medium.com/m/signin?operation=login&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=post_page---top_nav_layout_nav-----------------------global_nav------------------)

Member-only story
# Adding Columns to Pandas DataFrames
[](https://giulio-laurenti.medium.com/?source=post_page---byline--d4f587709d81---------------------------------------)
[Giulio Laurenti, PhD](https://giulio-laurenti.medium.com/?source=post_page---byline--d4f587709d81---------------------------------------)
Follow
5 min read
·
1 hour ago
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fvote%2Fp%2Fd4f587709d81&operation=register&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&user=Giulio+Laurenti%2C+PhD&userId=2489258d6569&source=---header_actions--d4f587709d81---------------------clap_footer------------------)
[](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2F_%2Fbookmark%2Fp%2Fd4f587709d81&operation=register&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=---header_actions--d4f587709d81---------------------bookmark_footer------------------)
[Listen](https://medium.com/m/signin?actionUrl=https%3A%2F%2Fmedium.com%2Fplans%3Fdimension%3Dpost_audio_button%26postId%3Dd4f587709d81&operation=register&redirect=https%3A%2F%2Fgiulio-laurenti.medium.com%2Fadding-columns-to-pandas-dataframes-d4f587709d81&source=---header_actions--d4f587709d81---------------------post_audio_button------------------)
Share
Press enter or click to view image in full size

Photo by [Simone Dinoia](https://unsplash.com/@simonedna?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/photos/a-couple-of-pandas-that-are-sitting-in-a-tree-cKlloJkCPm0?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
[_Link for non-members_](https://giulio-laurenti.medium.com/adding-columns-to-pandas-dataframes-d4f587709d81?sk=458ecfff85fc163e49316e68f72926c6)
In a [previous post](https://medium.com/@giulio-laurenti/adding-rows-to-pandas-dataframes-2863e1cd0804), we learned to add rows to a DataFrame. Here, we will learn to add columns.
For this article, we will import both Pandas and Numpy.
import pandas as pd
import numpy as np
Create a Dictionary with students’ names and Math results, and from it cr
DeepCamp AI