SlideShare a Scribd company logo
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. |
Python Development Example
Merge Pandas DataFrame
Johan Louwers – Chief Customer Architect @ Oracle
Version : Feb 2019
@johanlouwers
Johanlouwers.blogspot.com
Oracle Confidential – Internal/Restricted/Highly Restricted
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Safe Harbor Statement
The following is intended to outline our general product direction. It is intended for
information purposes only, and may not be incorporated into any contract. It is not a
commitment to deliver any material, code, or functionality, and should not be relied upon
in making purchasing decisions. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole discretion of Oracle.
2
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
Python Development
with pandas and CX_Oracle
Slide-deck Intention :
• This presentation is intended to provide
a quick introduction example on how to
merge two DataFrames in Pandas
• This example is a part of a wider
workshop deck and shared as a stand-
alone example for ease of sharing.
• The code should only be used as an
educational example and is not
intended to be included in any real-
world application code.
3
Contact details :
Johan Louwers - Chief Customer Architect
@johanlouwers
Johan.louwers@oracle.com
github.com/louwersj
Johanlouwers.blogspot.com
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. |
A B C D
0 A0 B0 C0 D0
1 A1 B1 C1 D1
2 A2 B2 C2 D2
4
A B C D
0 A0 B0 C0 D0
1 A1 B1 C1 D1
2 A2 B2 C2 D2
A B C_x D_x C_y D_y
0 A0 B0 C0 D0 C0 D0
1 A1 B1 C1 D1 C1 D1
2 A2 B2 C2 D2 C2 D2
pd.read_csv
pd.read_csv
pd.merge
Python Development
Pandas – merge DataFrame
What do we want to achieve?
1) Load two sets of data from .csv files
2) “merge” them into a single dataframe
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | 5
import pandas as pd
df0 = pd.read_csv('../../data/dataset_4.csv', delimiter=";",)
print ('show the content of the first file via dataframe df0')
print (df0.head())
df1 = pd.read_csv('../../data/dataset_5.csv', delimiter=";",)
print ('show the content of the second file via dataframe df1')
print (df1.head())
df2 = pd.merge(df0, df1, on=['Country Code','Country Name'])
print ('show the content of merged dataframes as a single dataframe')
print (df2.head())
Python Development
Pandas – merge DataFrame
Read first
CSV file
Read second
CSV file
Merge
DataFrames
Show me the code
1) Please note the 3 steps in the above code (two times read_csv() and one merge()
2) Find example at : https://github.com/louwersj/examples_machineLearning/blob/master/pandas/merging/pd_merge_example_1.py
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | 6
Python Development
Pandas – merge DataFrame
Show me the output
1) Do note that the two “original” dataFrame objects contain each 63 columns
2) Do note that the “merged” DataFrame contains 124 columns and not 126 columns.
Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 7
Oracle python pandas merge DataFrames

More Related Content

What's hot (20)

PPTX
Azure Search 言語処理関連機能 〜 アナライザー、検索クエリー、辞書、& ランキング, etc
Yoichi Kawasaki
 
ZIP
NoSQL databases
Harri Kauhanen
 
PDF
Graph based data models
Moumie Soulemane
 
PPTX
Introduction to pandas
Piyush rai
 
PDF
ClickHouse Monitoring 101: What to monitor and how
Altinity Ltd
 
PPTX
Introduction to matplotlib
Piyush rai
 
PDF
Trees, Binary Search Tree, AVL Tree in Data Structures
Gurukul Kangri Vishwavidyalaya - Faculty of Engineering and Technology
 
PPTX
Explainable AI
Wagston Staehler
 
ODP
Mongo indexes
paradokslabs
 
PPTX
NOSQL Databases types and Uses
Suvradeep Rudra
 
PPT
Python Pandas
Sunil OS
 
PPTX
Data models in NoSQL
Dr-Dipali Meher
 
PDF
最新機能までを総ざらい!PostgreSQLの注目機能を振り返る(第32回 中国地方DB勉強会 in 岡山 発表資料)
NTT DATA Technology & Innovation
 
PPTX
Apache Pinot Meetup Sept02, 2020
Mayank Shrivastava
 
PPTX
Deep Learning Tutorial | Deep Learning TensorFlow | Deep Learning With Neural...
Simplilearn
 
PDF
Matrix Factorization
Yusuke Yamamoto
 
PDF
The matplotlib Library
Haim Michael
 
PPTX
Data Analysis with Python Pandas
Neeru Mittal
 
PPTX
Support Vector Machine and Implementation using Weka
Macha Pujitha
 
PPTX
はじめてのElasticsearchクラスタ
Satoyuki Tsukano
 
Azure Search 言語処理関連機能 〜 アナライザー、検索クエリー、辞書、& ランキング, etc
Yoichi Kawasaki
 
NoSQL databases
Harri Kauhanen
 
Graph based data models
Moumie Soulemane
 
Introduction to pandas
Piyush rai
 
ClickHouse Monitoring 101: What to monitor and how
Altinity Ltd
 
Introduction to matplotlib
Piyush rai
 
Trees, Binary Search Tree, AVL Tree in Data Structures
Gurukul Kangri Vishwavidyalaya - Faculty of Engineering and Technology
 
Explainable AI
Wagston Staehler
 
Mongo indexes
paradokslabs
 
NOSQL Databases types and Uses
Suvradeep Rudra
 
Python Pandas
Sunil OS
 
Data models in NoSQL
Dr-Dipali Meher
 
最新機能までを総ざらい!PostgreSQLの注目機能を振り返る(第32回 中国地方DB勉強会 in 岡山 発表資料)
NTT DATA Technology & Innovation
 
Apache Pinot Meetup Sept02, 2020
Mayank Shrivastava
 
Deep Learning Tutorial | Deep Learning TensorFlow | Deep Learning With Neural...
Simplilearn
 
Matrix Factorization
Yusuke Yamamoto
 
The matplotlib Library
Haim Michael
 
Data Analysis with Python Pandas
Neeru Mittal
 
Support Vector Machine and Implementation using Weka
Macha Pujitha
 
はじめてのElasticsearchクラスタ
Satoyuki Tsukano
 

Similar to Oracle python pandas merge DataFrames (20)

PDF
Importing Data Sets | Importing Data Sets | Importing Data Sets
Ayxanhmdzad
 
PPTX
import data from Oracle Database into Python Pandas Dataframe
Johan Louwers
 
PDF
pandas.pdf
AjeshSurejan2
 
PDF
pandas (1).pdf
AjeshSurejan2
 
PDF
Week2: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
PPTX
Group B - Pandas Pandas is a powerful Python library that provides high-perfo...
HarshitChauhan88
 
PDF
SciPy 2011 pandas lightning talk
Wes McKinney
 
PPTX
python-pandas-For-Data-Analysis-Manipulate.pptx
PLOKESH8
 
PPTX
Lecture 3 intro2data
Johnson Ubah
 
PPTX
Pandas csv
Devashish Kumar
 
PPTX
Pandas
Dr. Chitra Dhawale
 
PPTX
pandas directories on the python language.pptx
SumitMajukar
 
PPTX
Handling Missing Data for Data Analysis.pptx
Ramakrishna Reddy Bijjam
 
PPTX
Complete Introduction To Pandas Python.pptx
ARUN R S
 
PPTX
Pandas-(Ziad).pptx
Sivam Chinna
 
PPTX
dataframe_operations and various functions
JayanthiM19
 
PDF
Pandas in Python for Data Exploration .pdf
sejalkadam21
 
PDF
Python Data Wrangling: Preparing for the Future
Wes McKinney
 
PDF
Worksheet - python Pandas numerical py pdf
udaywalnandini
 
PDF
Pandas in Depth_ Data Manipultion(Chapter 5)(Important).pdf
jagatpal4217
 
Importing Data Sets | Importing Data Sets | Importing Data Sets
Ayxanhmdzad
 
import data from Oracle Database into Python Pandas Dataframe
Johan Louwers
 
pandas.pdf
AjeshSurejan2
 
pandas (1).pdf
AjeshSurejan2
 
Week2: Programming for Data Analysis
Ferdin Joe John Joseph PhD
 
Group B - Pandas Pandas is a powerful Python library that provides high-perfo...
HarshitChauhan88
 
SciPy 2011 pandas lightning talk
Wes McKinney
 
python-pandas-For-Data-Analysis-Manipulate.pptx
PLOKESH8
 
Lecture 3 intro2data
Johnson Ubah
 
Pandas csv
Devashish Kumar
 
pandas directories on the python language.pptx
SumitMajukar
 
Handling Missing Data for Data Analysis.pptx
Ramakrishna Reddy Bijjam
 
Complete Introduction To Pandas Python.pptx
ARUN R S
 
Pandas-(Ziad).pptx
Sivam Chinna
 
dataframe_operations and various functions
JayanthiM19
 
Pandas in Python for Data Exploration .pdf
sejalkadam21
 
Python Data Wrangling: Preparing for the Future
Wes McKinney
 
Worksheet - python Pandas numerical py pdf
udaywalnandini
 
Pandas in Depth_ Data Manipultion(Chapter 5)(Important).pdf
jagatpal4217
 
Ad

More from Johan Louwers (20)

PDF
Multi Domain REST API routing for Data Mesh based Data Products
Johan Louwers
 
PDF
TClab Dynamic Solar Panel Positioning Systems
Johan Louwers
 
PPTX
Oracle Cloud With Azure DevOps Pipelines
Johan Louwers
 
PPTX
Oracle Cloud native functions - create application from cli
Johan Louwers
 
PPTX
Oracle Labs - research mission & project potfolio
Johan Louwers
 
PPTX
Install Redis on Oracle Linux
Johan Louwers
 
PPTX
Fn project quick installation guide
Johan Louwers
 
PDF
Voice assistants for the insurance industry
Johan Louwers
 
PPTX
Enterprise wide publish subscribe with Apache Kafka
Johan Louwers
 
PPTX
Industry 4.0 and Oracle Cloud
Johan Louwers
 
PPTX
Docker and microservices - moving from a monolith to microservices
Johan Louwers
 
PDF
Cloud native applications for banking
Johan Louwers
 
PPTX
Conversational retail
Johan Louwers
 
PPTX
Oracle Cloudday security
Johan Louwers
 
PPTX
Oracle Cloudday - the future of retail
Johan Louwers
 
PPTX
Capgemini Oracle Cloud Access Security Broker
Johan Louwers
 
PPTX
Microservices in the oracle cloud
Johan Louwers
 
PPTX
Oracle cloud, private, public and hybrid
Johan Louwers
 
PPTX
RethinkDB on Oracle Linux
Johan Louwers
 
PPTX
Oracle Cloud Hybrid Storage Tiering
Johan Louwers
 
Multi Domain REST API routing for Data Mesh based Data Products
Johan Louwers
 
TClab Dynamic Solar Panel Positioning Systems
Johan Louwers
 
Oracle Cloud With Azure DevOps Pipelines
Johan Louwers
 
Oracle Cloud native functions - create application from cli
Johan Louwers
 
Oracle Labs - research mission & project potfolio
Johan Louwers
 
Install Redis on Oracle Linux
Johan Louwers
 
Fn project quick installation guide
Johan Louwers
 
Voice assistants for the insurance industry
Johan Louwers
 
Enterprise wide publish subscribe with Apache Kafka
Johan Louwers
 
Industry 4.0 and Oracle Cloud
Johan Louwers
 
Docker and microservices - moving from a monolith to microservices
Johan Louwers
 
Cloud native applications for banking
Johan Louwers
 
Conversational retail
Johan Louwers
 
Oracle Cloudday security
Johan Louwers
 
Oracle Cloudday - the future of retail
Johan Louwers
 
Capgemini Oracle Cloud Access Security Broker
Johan Louwers
 
Microservices in the oracle cloud
Johan Louwers
 
Oracle cloud, private, public and hybrid
Johan Louwers
 
RethinkDB on Oracle Linux
Johan Louwers
 
Oracle Cloud Hybrid Storage Tiering
Johan Louwers
 
Ad

Recently uploaded (20)

PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PDF
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
CIFDAQ Weekly Market Wrap for 11th July 2025
CIFDAQ
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
Transcript: New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
July Patch Tuesday
Ivanti
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 

Oracle python pandas merge DataFrames

  • 1. Copyright © 2016, Oracle and/or its affiliates. All rights reserved. | Python Development Example Merge Pandas DataFrame Johan Louwers – Chief Customer Architect @ Oracle Version : Feb 2019 @johanlouwers Johanlouwers.blogspot.com Oracle Confidential – Internal/Restricted/Highly Restricted
  • 2. Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Safe Harbor Statement The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Python Development with pandas and CX_Oracle Slide-deck Intention : • This presentation is intended to provide a quick introduction example on how to merge two DataFrames in Pandas • This example is a part of a wider workshop deck and shared as a stand- alone example for ease of sharing. • The code should only be used as an educational example and is not intended to be included in any real- world application code. 3 Contact details : Johan Louwers - Chief Customer Architect @johanlouwers [email protected] github.com/louwersj Johanlouwers.blogspot.com
  • 4. Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | A B C D 0 A0 B0 C0 D0 1 A1 B1 C1 D1 2 A2 B2 C2 D2 4 A B C D 0 A0 B0 C0 D0 1 A1 B1 C1 D1 2 A2 B2 C2 D2 A B C_x D_x C_y D_y 0 A0 B0 C0 D0 C0 D0 1 A1 B1 C1 D1 C1 D1 2 A2 B2 C2 D2 C2 D2 pd.read_csv pd.read_csv pd.merge Python Development Pandas – merge DataFrame What do we want to achieve? 1) Load two sets of data from .csv files 2) “merge” them into a single dataframe
  • 5. Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | 5 import pandas as pd df0 = pd.read_csv('../../data/dataset_4.csv', delimiter=";",) print ('show the content of the first file via dataframe df0') print (df0.head()) df1 = pd.read_csv('../../data/dataset_5.csv', delimiter=";",) print ('show the content of the second file via dataframe df1') print (df1.head()) df2 = pd.merge(df0, df1, on=['Country Code','Country Name']) print ('show the content of merged dataframes as a single dataframe') print (df2.head()) Python Development Pandas – merge DataFrame Read first CSV file Read second CSV file Merge DataFrames Show me the code 1) Please note the 3 steps in the above code (two times read_csv() and one merge() 2) Find example at : https://github.com/louwersj/examples_machineLearning/blob/master/pandas/merging/pd_merge_example_1.py
  • 6. Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | 6 Python Development Pandas – merge DataFrame Show me the output 1) Do note that the two “original” dataFrame objects contain each 63 columns 2) Do note that the “merged” DataFrame contains 124 columns and not 126 columns.
  • 7. Copyright © 2015 Oracle and/or its affiliates. All rights reserved. | Oracle Confidential – Internal/Restricted/Highly Restricted 7