Pandas SQL Query: 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.
REGION.csv
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:
Python Code Editor:
Structure of 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 display all the location id from locations file.
What is the difficulty level of this exercise?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://198.211.115.131/python-exercises/pandas/sql/python-pandas-hr-database-queries-exercise-1.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics