# Importing Scientific Data using Pandas [Introduction text] Pandas is a library that is built on top of NumPy and is therefore customarily to import both when working with Pandas. ```python import numpy as np import pandas as pd ``` --- DataFrame A `DataFrame` in pandas is a two-dimensional data structure like table with rows and columns. We can either load some data in a [python dictionary:](https://www.w3schools.com/python/python_dictionaries.asp) ```python # Tensile test data data = { "Force (N)": [10, 15, 20, 25], "Displacement (mm)": [1.2, 1.8, 2.5, 3.0], "Stress (MPa)": [2.6, 3.9, 5.2, 6.5], } ``` Or we can load a spreadsheet in the form of a CSV file with the `read_csv()` function. In order to do this we need ```python # Read CSV file into a DataFrame pd.read_csv("data.csv") ``` --- Alternatively, the `read_excel()` function allows you to import xlsx files. For this you need to specify the sheet name. ```python df.read_excel("foo.xlsx", sheet_name="Sheet1", index_col=None, na_values=["NA"]) ``` --- Object Creation Up to this point, the data has been read into memory but not assigned to a variable. By convention, we will assign the resulting DataFrame to the variable `df`, where the name `df` serves as a common shorthand for “data frame.” ```python # Create DataFrame with row labels df = pd.DataFrame(data, index=["Test1", "Test2", "Test3", "Test4"]) print(df) ``` Creating the object allows us to re-call the data or specific data points if needed. --- Calling Data Data can be called using the square brackets. We can get an entire column or row using it's label as follows: Single point: ```python df[3,2] ``` Ranges: ```python df[2:4,2:3] ``` Data series by label ```python df["Test1"] ``` --- Assignment 1: ```python ``` --- Assignment 2: Load a the data from the csv file and calculate the mean point of the array. ```python ```