summaryrefslogtreecommitdiff
path: root/tutorials/module_4/1_importing_scientific_data.md
blob: b51558b09b78344636dd0d9859a7e47ec673b97c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Importing Scientific Data using Pandas

^8eb966

[Introduction text]


Pandas is a library that is built on top of NumPy and is there for 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.



```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],
}
```



Object Creation

```python
# Create DataFrame with row labels
df = pd.DataFrame(data, index=["Test1", "Test2", "Test3", "Test4"])

print(df)
```