Data Frame. Source : Geeksforgeeks

Data Frame. Source : Geeksforgeeks

Data Frame is a 2-dimensional data structure whose columns have labels and usually have different data types. Data frames are one of the most important concepts in data processing using libraries such as pandas in Python.

Data frames consist of rows and columns, where each column can contain a different type of data, such as string, numeric, or date. The first row in the data frame is the label or data name of the column below it.

The most common library used to create, and manage data frames in Python is the pandas library. With data frames we can perform various operations such as indexing, filtering, aggregation, and data visualization easily.

Import Data from Microsoft Excel to Data Frame

Excel. Source : syntaxbytetutorials

Excel. Source : syntaxbytetutorials

In general, data in Microsoft Excel is structured in row and column format. The column serves as a label for the data located below it.

The most recent data format in Excel is .xlsx, which is often used to store and manage large amounts of data. However, there are obstacles when it comes to collaboration with others because accessibility is limited by the need to install Microsoft Excel software on each individual computer.

A. How to Import

When we have a Microsoft Excel file (.xlsx), we run the code below to import data from a Microsoft Excel file

df_excel = pd.read_excel(‘Online Retail Data.xlsx’, sheet name =’Online Retail Data’, header=0 )
df_excel
  1. df_excel : Save the frame data to be read from Excel file.

  2. 'Online Retail Data.xlsx' : The name of the Excel file to be read.

  3. sheet_name='Online Retail Data' : The name of the worksheet to be read.

  4. header=0 : This parameter indicates that the first row in the Excel data contains column names (headers).

  5. df_excel : The result will be stored in the df_excel variable.

Import Data from CSV to Data Frame