1. Reading or Loading Data

In this Document , You will cover how to load different types of data in pandas.

Before Going ahead Download all these Files and Save in your project.

8KB
Open
232B
Open

How to read Excel File (Sales.xlsx)

To read an Excel file like "Sales.xlsx" in Python, you can use the pandas library along with openpyxl for modern Excel files (.xlsx) or xlrd for older Excel files (.xls). Below is an example:

Ensure you have installed the necessary libraries before running this script in the terminal:

How to read CSV Files (Sales.csv)

To read a CSV file like "Sales.csv" in Python, you can use the pandas library. Below is an example:

Ensure that pandas is installed, as shown previously. With this approach, you'll be able to load and analyze your CSV data efficiently.

How to read json files (Employee_sales_data.json)

To read a JSON file like "Employee_sales_data.json" in Python, you can also use the pandas library. Here's how you can do it:

Ensure pandas is installed to access and manipulate your JSON data effectively. This approach is useful for processing JSON files with ease.

How to read Multiple sheets from Sales and customer.xlsx

To read multiple sheets from an Excel file like "Sales and customer.xlsx" into separate DataFrames, you can use the pandas library's read_excel function with the sheet_name parameter. Here's how you can do it:

This method allows you to read specific sheets by specifying their names and loading them into different DataFrames for further processing.

Last updated