Soil Index Subaccessor#
In this guide, the basics of the index
subaccessor methods
are presented. The index
subaccessor is a collection of
methods related to index property laboratory tests for each sample of each point in the
DataFrame
. The index properties of soil are the properties which help to
assess the engineering behavior of soil and determine the classification of soil accurately. For
information about the columns used by this subaccessor, see Soil Index Columns.
First, we import the necessary libraries,
In [1]: import pandas as pd
In [2]: import geotech_pandas
Next, we create a DataFrame
with the following data,
In [3]: df = pd.DataFrame(
...: {
...: "point_id": ["BH-1", "BH-1", "BH-1"],
...: "bottom": [1.0, 1.5, 3.0],
...: "moisture_content_mass_moist": [236.44, 154.40, 164.68],
...: "moisture_content_mass_dry": [174.40, 120.05, 134.31],
...: "moisture_content_mass_container": [22.20, 18.66, 20.27],
...: }
...: )
...:
In [4]: df = df.convert_dtypes()
In [5]: df
Out[5]:
point_id bottom ... moisture_content_mass_dry moisture_content_mass_container
0 BH-1 1.0 ... 174.4 22.2
1 BH-1 1.5 ... 120.05 18.66
2 BH-1 3.0 ... 134.31 20.27
[3 rows x 5 columns]
Note
Notice that the df
is reassigned with the result of
convert_dtypes()
method. This method converts the columns of
df
to the best possible dtypes that support NA
to consistently
represent missing data.
Use the dtypes
property to show the current dtypes of df
,
In [6]: df.dtypes
Out[6]:
point_id string[python]
bottom Float64
moisture_content_mass_moist Float64
moisture_content_mass_dry Float64
moisture_content_mass_container Float64
dtype: object
Getting the moisture content#
The get_moisture_content()
method returns a
Series
of moisture content values. This method requires the following
columns:
moisture_content_mass_moist
: mass of container and moist specimen, g.moisture_content_mass_dry
: mass of container and oven dry specimen, g.moisture_content_mass_container
: mass of container, g.
Note
Since the result of this method is in the form of a percentage, it isn’t particularly strict in using g as the unit. However, it is still important to use a consistent unit across these columns.
In [7]: df.geotech.lab.index.get_moisture_content()
Out[7]:
0 40.762155
1 33.879081
2 26.631007
Name: moisture_content, dtype: Float64