w3resource
Python Pandas Exercises

Pandas HR database: Display all the records of REGIONS file

Pandas HR database Queries: Exercise-1 with Solution

Write a Pandas program to display all the records of REGIONS file.

Sample Solution :

Python Code :

import pandas as pd
employees = pd.read_csv(r"EMPLOYEES.csv")
departments = pd.read_csv(r"DEPARTMENTS.csv")
job_history = pd.read_csv(r"JOB_HISTORY.csv")
jobs = pd.read_csv(r"JOBS.csv")
countries = pd.read_csv(r"COUNTRIES.csv")
regions = pd.read_csv(r"REGIONS.csv")
locations = pd.read_csv(r"LOCATIONS.csv")
print("All the records from regions file:")
print(regions)

Sample Output:

All the records from regions file:
   REGION_ID             REGION_NAME
0          1                  Europe
1          2                Americas
2          3                    Asia
3          4  Middle East and Africa

Equivalent SQL Syntax:

SELECT * FROM REGIONS;

Click to view the table contain:

Employees Table

Departments Table

Countries Table

Job_History Table

Jobs Table

Locations Table

Regions Table

Python Code Editor:


Structure of HR database :

HR database

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Python Pandas HR database Exercises Home.
Next: Write a Pandas program to extract first 7 records from employees file.

What is the difficulty level of this exercise?