solarwindpy.core.plasma.Plasmaο
- class Plasma(data, *species, spacecraft=None, auxiliary_data=None, log_plasma_stats=False)[source]ο
Bases:
BaseContainer for multi-species plasma physics data and analysis.
The Plasma class serves as the central container for solar wind plasma analysis, combining ion moment data, magnetic field measurements, and spacecraft trajectory information for comprehensive plasma physics calculations.
This class enables analysis of multi-species plasma including protons, alpha particles, and heavier ions. It provides convenient access to ion species through attribute shortcuts and supports advanced plasma physics calculations such as plasma beta, Coulomb collision frequencies, and thermal parameters.
Attribute access is first attempted on the underlying
ionstable before falling back tosuper().__getattr__. This allows convenient shorthand such asplasma.ato access the alpha particleIonandplasma.p1for protons.- dataο
Multi-indexed DataFrame containing plasma measurements with columns labeled by (βMβ, βCβ, βSβ) for measurement, component, and species.
- Type:
- ionsο
Dictionary-like access to individual ion species objects.
- Type:
pandas.Series of Ion objects
- spacecraftο
Spacecraft trajectory and velocity information.
- Type:
Spacecraft, optional
- auxiliary_dataο
Additional measurements such as quality flags or derived parameters.
- Type:
pandas.DataFrame, optional
Notes
Thermal speeds assume the relationship \(mw^2 = 2kT\) where \(m\) is ion mass, \(w\) is thermal speed, \(k\) is Boltzmannβs constant, and \(T\) is temperature.
The underlying data structure uses a three-level MultiIndex for columns: - Level 0 (M): Measurement type (βnβ, βvβ, βwβ, βbβ, etc.) - Level 1 (C): Component (βxβ, βyβ, βzβ, βparβ, βperβ, etc.) - Level 2 (S): Species identifier (βp1β, βaβ, βo6β, etc.)
Examples
Create a plasma object from multi-species data:
>>> import pandas as pd >>> import numpy as np >>> # Create sample MultiIndex data >>> epoch = pd.date_range('2023-01-01', periods=3, freq='1min') >>> columns = pd.MultiIndex.from_tuples([ ... ('n', '', 'p1'), ('v', 'x', 'p1'), ('v', 'y', 'p1'), ('v', 'z', 'p1'), ... ('n', '', 'a'), ('v', 'x', 'a'), ('v', 'y', 'a'), ('v', 'z', 'a'), ... ('w', 'par', 'p1'), ('w', 'per', 'p1'), ('w', 'par', 'a'), ('w', 'per', 'a'), ... ('b', 'x', ''), ('b', 'y', ''), ('b', 'z', '') ... ], names=['M', 'C', 'S']) >>> data = pd.DataFrame(np.random.rand(3, len(columns)), ... index=epoch, columns=columns) >>> plasma = Plasma(data, 'p1', 'a') # Protons and alphas >>> type(plasma.p1).__name__ # Proton ion object 'Ion'
Calculate plasma physics parameters:
>>> beta = plasma.beta('p1') # Plasma beta for protons >>> type(beta).__name__ 'Tensor'
Idenfity ion species in plasma:
>>> plasma.species ['p1', 'a']
- __init__(data, *species, spacecraft=None, auxiliary_data=None, log_plasma_stats=False)[source]ο
Initialize a
Plasmainstance.- Parameters:
data (
pandas.DataFrame) β Contains the magnetic field and core ion moments. Columns are a three-levelMultiIndexlabelled("M", "C", "S")for measurement, component, and species. The index should contain datetime information, for exampleEpochwhen loading from a CDF file.*species (str) β Iterable of species contained in
data.spacecraft (
Spacecraft, optional) β Spacecraft trajectory and velocity information. IfNone, the Coulomb numbernc()method will raise aValueError.auxiliary_data (
pandas.DataFrame, optional) β Additional measurements to carry with the plasma, for example data quality flags. The column labelling scheme must matchdata.log_plasma_stats (bool, default
False) β Log summary statistics whendatais set.
Notes
Thermal speeds assume \(mw^2 = 2kT\).
Examples
>>> epoch = pd.Series({0: pd.to_datetime("1995-01-01"), ... 1: pd.to_datetime("2015-03-23"), ... 2: pd.to_datetime("2022-10-09")}, name="Epoch") >>> data = { ... ("b", "x", ""): {0: 0.5, 1: 0.6, 2: 0.7}, ... ("b", "y", ""): {0: -0.25, 1: -0.26, 2: 0.27}, ... ("b", "z", ""): {0: 0.3, 1: 0.4, 2: -0.7}, ... ("n", "", "a"): {0: 0.5, 1: 1.0, 2: 1.5}, ... ("n", "", "p1"): {0: 1.0, 1: 2.0, 2: 3.0}, ... ("v", "x", "a"): {0: 125.0, 1: 250.0, 2: 375.0}, ... ("v", "x", "p1"): {0: 100.0, 1: 200.0, 2: 300.0}, ... ("v", "y", "a"): {0: 250.0, 1: 375.0, 2: 750.0}, ... ("v", "y", "p1"): {0: 200.0, 1: 300.0, 2: 600.0}, ... ("v", "z", "a"): {0: 500.0, 1: 750.0, 2: 1000.0}, ... ("v", "z", "p1"): {0: 400.0, 1: 600.0, 2: 800.0}, ... ("w", "par", "a"): {0: 3.0, 1: 4.0, 2: 5.0}, ... ("w", "par", "p1"): {0: 10.0, 1: 20.0, 2: 30.0}, ... ("w", "per", "a"): {0: 7.0, 1: 9.0, 2: 10.0}, ... ("w", "per", "p1"): {0: 7.0, 1: 26.0, 2: 28.0}, ... } >>> data = pd.DataFrame.from_dict(data, orient="columns") >>> data.columns.names = ["M", "C", "S"] >>> data.index = epoch >>> data.T Epoch 1995-01-01 2015-03-23 2022-10-09 M C S b x 0.50 0.60 0.70 y -0.25 -0.26 0.27 z 0.30 0.40 -0.70 n a 0.50 1.00 1.50 p1 1.00 2.00 3.00 v x a 125.00 250.00 375.00 p1 100.00 200.00 300.00 y a 250.00 375.00 750.00 p1 200.00 300.00 600.00 z a 500.00 750.00 1000.00 p1 400.00 600.00 800.00 w par a 3.00 4.00 5.00 p1 10.00 20.00 30.00 per a 7.00 9.00 10.00 p1 7.00 26.00 28.00 >>> plasma = Plasma(data, "a", "p1")
- property epochο
Time index of the plasma data.
- Returns:
Datetime index containing measurement timestamps.
- Return type:
Examples
>>> plasma.epoch DatetimeIndex(['1995-01-01', '2015-03-23', '2022-10-09'], dtype='datetime64[ns]', name='Epoch', freq=None)
- property spacecraftο
Spacecraft object stored in plasma.
- property scο
Shortcut to
spacecraft.
- property auxiliary_dataο
Any data that does not fall into the following categories.
Epoch is index.
-magnetic field -ion velocity -ion number density -ion thermal speed
- property auxο
Shortcut to
auxiliary_data.
- property log_plasma_at_initο
Flag indicating whether to log plasma statistics during initialization.
- Returns:
True if plasma statistics should be logged at initialization.
- Return type:
See also
set_log_plasma_statsMethod to modify this setting
- set_log_plasma_stats(new)[source]ο
Set flag for logging plasma statistics during initialization.
- Parameters:
new (bool) β Whether to enable logging of plasma statistics.
Notes
When enabled, summary statistics including density ranges, velocity distributions, and magnetic field statistics are logged during plasma initialization.
Examples
>>> plasma.set_log_plasma_stats(True) >>> plasma.log_plasma_at_init True
- save(fname, dkey='FC', sckey='SC', akey='FC_AUX', data_modifier_fcn=None, sc_modifier_fcn=None, aux_modifier_fcn=None)[source]ο
Save the plasmaβs data and aux DataFrame to an HDF5 file at fname.
- Parameters:
fname (str or pathlib.Path.) β File name pointing to the save location. The typical use when creating a data file in Create_Datafile.ipynb is fname(βsweβ, βh5β, strip_date=True).
dkey (None) β The HDF5 file key at which to store the data.
sckey (None) β The HDF5 file key at which to store the spacecraft data.
akey (None) β The HDF5 file key at which to store the auxiliary_data.
data_modifier_fcn (None, FunctionType) β
A function to modify the data saved, e.g. if you donβt want to save a specific species in the data file, you can pass.
- def modify_data(data):
return data.drop(βaβ, axis=1, level=βSβ)
It can only take one argument, data.
spacecraft_modifier_fcn (None, FunctionType) β A function to modifie the spacecraft data saved. See data_modifier_fcn for syntax.
aux_modifier_fcn (None, FunctionType) β A function to modify the auxiliary_data saved. See data_modifier_fcn for syntax.
- classmethod load_from_file(fname, *species, dkey='FC', sckey='SC', akey='FC_AUX', sc_frame=None, sc_name=None, start=None, stop=None, **kwargs)[source]ο
Load data from an HDF5 file at fname and create a plasma.
- Parameters:
fname (str or pathlib.Path) β The file from which to load the data.
species (list-like of str) β The species to load. If none are passed, they are automatically selected from the data.
dkey (str, "FC") β The key for getting data from HDF5 file.
sckey (str, "SC") β The key for getting spacecraft data from the HDF5 file.
akey (str, "FC_AUX") β key for getting auxiliary data from HDF5 file.
start (None, parsable by pd.to_datetime) β If not None, time to start/stop for loading data.
stop (None, parsable by pd.to_datetime) β If not None, time to start/stop for loading data.
kwargs β Passed to Plasma.__init__.
- property speciesο
Tuple of species contained in plasma.
- property ionsο
pd.Series containing the ions.
- drop_species(*species: str) Plasma[source]ο
Return a new
Plasmawithout the specified species.- Parameters:
*species (str) β Species to remove from the plasma.
- Returns:
A new plasma containing only the remaining species.
- Return type:
- Raises:
ValueError β If all species are removed.
- set_spacecraft(new)[source]ο
Set or update the spacecraft trajectory data.
- Parameters:
new (Spacecraft or None) β Spacecraft trajectory object containing position and velocity data. Must have matching datetime index with plasma data.
- Raises:
AssertionError β If spacecraft index does not match plasma data index.
Notes
The spacecraft data is required for calculating certain plasma physics parameters such as Coulomb collision frequencies that depend on the plasma frame transformation.
Examples
>>> sc = Spacecraft(trajectory_data) >>> plasma.set_spacecraft(sc) >>> plasma.spacecraft.position # Access trajectory data
- set_auxiliary_data(new)[source]ο
Set or update auxiliary measurement data.
- Parameters:
new (pandas.DataFrame or None) β Additional measurements such as data quality flags, derived parameters, or instrument-specific metadata. Must have matching datetime index with plasma data.
- Raises:
AssertionError β If auxiliary data index does not match plasma data index.
Notes
Auxiliary data provides additional context for plasma measurements without being part of the core plasma physics calculations. Common examples include quality flags, statistical uncertainties, or instrument operational parameters.
Examples
>>> quality_flags = pd.DataFrame({'quality': [0, 1, 0]}, ... index=plasma.epoch) >>> plasma.set_auxiliary_data(quality_flags) >>> plasma.aux.quality # Access auxiliary data
- property bfieldο
Magnetic field data.
- number_density(*species, skipna=True)[source]ο
Get the plasma number densities.
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.
skipna (bool, default True) β Follows pd.DataFrame.sum convention. If True, NA excluded from results. If False, NA propagates. False is helpful to identify when a species is not measured using NaNs in its number density.
- Returns:
n β See Parameters for more info.
- Return type:
pd.Series or pd.DataFrame
- n(*species, skipna=True)[source]ο
Shortcut to
number_density().
- mass_density(*species)[source]ο
Get the plasma mass densities.
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.
- Returns:
rho β See Parameters for more info.
- Return type:
pd.Series or pd.DataFrame
- rho(*species)[source]ο
Shortcut to
mass_density().
- thermal_speed(*species)[source]ο
Get the thermal speed.
- Parameters:
species (str) β Each species is a string. A total species (βs0+s1+β¦β) cannot be passed because the result is physically amibguous.
- Returns:
w β See Parameters for more info.
- Return type:
pd.Series or pd.DataFrame
- w(*species)[source]ο
Shortcut to
thermal_speed().
- pth(*species)[source]ο
Get the thermal pressure.
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.
- Returns:
pth β See Parameters for more info.
- Return type:
pd.Series or pd.DataFrame
- temperature(*species)[source]ο
Get the thermal temperature.
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.
- Returns:
temp β See Parameters for more info.
- Return type:
pd.Series or pd.DataFrame
- beta(*species)[source]ο
Get perpendicular, parallel, and scalar plasma beta.
- Parameters:
species (str) β Each species is a string. Species handling controlled by
pth().- Returns:
beta β See Parameters for more info.
- Return type:
pd.DataFrame
Notes
In uncertain units, the NRL Plasma Formulary (2016) defined \(\beta\):
\(\beta = \frac{8 \pi n k_B T}{B^2} = \frac{2 k_b T / m}{B^2 / 4 \phi \rho}\)
and the Alfven speed as:
\(C_A^2 = B^2 / 4 \pi \rho\).
I define thermal speed as:
\(w^2 = \frac{2 k_B T}{m}\).
Combining these equations, we get:
\(\beta = w^2 / C_A^2\),
which is independent of dimensional constants. Given I define \(p_{th} = \frac{1}{2} \rho w^2\) and \(C_A^2 = \frac{1}{\mu_0}B^2 \rho\) in SI units, I can rewrite \(\beta\)
\(\beta = \frac{2 p_{th}}{\rho} \frac{\mu_0 \rho}{B^2} = \frac{2 \mu_0 p_{th}}{B^2}\).
- anisotropy(*species)[source]ο
Pressure anisotropy.
Note that for a single species, the pressure anisotropy is just the temperature anisotropy.
- velocity(*species, project_m2q=False)[source]ο
Get an ion velocity or calculate the center-of-mass velocity.
- Parameters:
species (str) β Each species is a string. If only one string is passed and contains β+β, return a pd.Series containing the center-of-mass velocity
Vector. If contains a single species, return that ionβs velocity.project_m2q (bool, False) β If True, project velocity by \(\sqrt{m/q}\). Disables center-of- mass species.
- Returns:
velocity
- Return type:
pd.Seriesorpd.DataFrame
- dv(s0, s1, project_m2q=False)[source]ο
Calculate the differential flow between species s0 and s1.
Calculate the differential flow between species s0 and species s1: \(v_{s0} - v_{s1}\).
- Parameters:
s0 (str) β If either species contains a β+β, the center-of-mass velocity for the indicated species is used.
s1 (str) β If either species contains a β+β, the center-of-mass velocity for the indicated species is used.
project_m2q (bool, False) β If True, project each speed by \(\sqrt{m/q}\). Disables center- of-mass species.
- Returns:
dv
- Return type:
See also
vector.Vector
- pdynamic(*species, project_m2q=False)[source]ο
Calculate the dynamic or drift pressure for the given species.
\(p_{\tilde{v}} = 0.5 \sum_i \rho_i (v_i - v_\mathrm{com})^2\)
The calculation is done in the plasma frame.
- Parameters:
species (list-like of str) β List-like of individual species, e.g. [βaβ, βp1β]. Can NOT be a list-like including sums, e.g. [βaβ, βp1+p2β].
project_m2q (bool, False) β If True, project the velocities by \(\sqrt{m/q}\). Allows for only two species to be passed and takes the differential flow between them.
- Returns:
pdv β Dynamic pressure due to species.
- Return type:
pd.Series
- pdv(*species, project_m2q=False)[source]ο
Shortcut to
pdynamic().
- sound_speed(*species)[source]ο
Calculate the sound speed.
- Parameters:
species (str) β TODO: What controls species?
- Returns:
cs
- Return type:
pd.DataFrame or pd.Series depending on species inputs.
- cs(*species)[source]ο
Shortcut to
sound_speed().
- ca(*species)[source]ο
Calculate the isotropic MHD Alfven speed.
- Parameters:
species (str) β Species controlled by
mass_density()- Returns:
ca
- Return type:
pd.DataFrame or pd.Series depending on species inputs.
- afsq(*species, pdynamic=False)[source]ο
Calculate the square of anisotropy factor.
\(AF^2 = 1 + \frac{\mu_0}{B^s}\left(p_\perp - p_\parallel - p_{\tilde{v}}\right)\)
- N.B. Because of the \(1 +\), afsq(s0, s1).sum(axis=1) is not the
same as afsq(s0+s1). The two are related by:
afsq.(s0+s1) = 1 + (afsq(s0, s1) - 1).sum(axis=1)
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.
pydnamic (bool, str) β If str, the component of the dynamic pressure to use when calculating \(p_{\tilde{v}}\).
- Returns:
afsq
- Return type:
pd.Series or pd.DataFrame depending on the len(species).
- caani(*species, pdynamic=False)[source]ο
Calculate the anisotropic MHD Alfven speed:
\(C_{A;Ani} = C_A\sqrt{AFSQ}\)
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. In either case, all species are summed over and a pd.Series is returned. This addresses complications from the stuple = self._chk_species(*species) mass densities in Ca and AFSQ, the latter via
pth().pydnamic (bool, str) β If str, the component of the dynamic pressure to use when calculating \(p_{\tilde{v}}\).
- Returns:
caani β Only pd.Series is returned because of the combination of mass density and pressure terms in the CaAni equation.
- Return type:
pd.Series
- lnlambda(s0, s1)[source]ο
Calculate the Coulomb logarithm between species s0 and s1.
\(\ln_\lambda_{i,i} = 29.9 - \ln(\frac{z_0 * z_1 * (a_0 + a_1)}{a_0 * T_1 + a_1 * T_0} \sqrt{\frac{n_0 z_0^2}{T_0} + \frac{n_1 z_1^2}{T_1}})\)
- Parameters:
species (str) β Each species is a string. It cannot be a sum of species, nor can it be an iterable of species.
- Returns:
lnlambda β Only pd.Series is returned because Coulomb require species alignment in such a fashion that array operations using pd.DataFrame alignment wonβt work.
- Return type:
pd.Series
See also
- nuc(sa, sb, both_species=True)[source]ο
Calculate the momentum collision rate following [1].
- Parameters:
sa (str) β The test, field particle species. Each can only identify a single ion species and it cannot be an iterable of lists, etc.
sb (str) β The test, field particle species. Each can only identify a single ion species and it cannot be an iterable of lists, etc.
both_species (bool) β If True, calculate the effective collision rate for a two-ion-species plasma following Eq. (23). Otherwise, calculate it following Eq. (18).
- Returns:
nu
- Return type:
pd.Series
Notes
If nu.name is βsa-sbβ, then both_species=False in calclulation. If nu.name is βsa+sbβ, then both_species=True.
References
- [1] HernΓ‘ndez, R., & Marsch, E. (1985). Collisional time scales for
temperature and velocity exchange between drifting Maxwellians. Journal of Geophysical Research, 90(A11), 11062. <https://doi.org/10.1029/JA090iA11p11062>.
- nc(sa, sb, both_species=True)[source]ο
Calculate the Coulomb number between species sa and sb.
- Parameters:
sa (str) β Species identifying the ions to use in calculation. Canβt be a combination of things like βs0+s1β, βs0,s1β, nor (βs0β, βs1β).
sb (str) β Species identifying the ions to use in calculation. Canβt be a combination of things like βs0+s1β, βs0,s1β, nor (βs0β, βs1β).
both_species (bool) β Passed to nuc. If True, calculate the two-ion-plasma collision frequency.
- Returns:
nc β Coulomb number
- Return type:
pd.Series
- vdf_ratio(beam='p2', core='p1')[source]ο
Calculate the ratio of the VDFs at the beam velocity.
Calculate the ratio of a bi-Maxwellian proton beam to a bi-Maxwellian proton core VDF at the peak beam velocity.
To avoid overflow erros, we return ln(ratio).
The VDF for species \(i\) at velocity \(v_j\) is:
\(f_i(v_j) = \frac{n_i}{(\pi w_i ^2)^{3/2}} \exp[ -(\frac{v_j - v_i}{w_i})^2]\)
The beam to core VDF ratio evaluated at the proton beam velocity is:
\(\frac{f_2}{f_1}|_{v_2} = \frac{n_2}{n_1} ( \frac{w_1}{w_2} )^3 \exp[ (\frac{v_2 - v_1}{w_1})^2 ]\)
where \(n\) is the number density, \(w\) gives the thermal speed, and \(u\) is the bulk velocity.
In the case of a Bimaxwellian, we \(w^3 = w_\parallel w_\perp^2\) \((\frac{v - v_i}{w_i})^2 = (\frac{v - v_i}{w_i})_\parallel^2 + (\frac{v - v_i}{w_i})_\perp^2\).
- Parameters:
- Returns:
f2f1 β Natural logarithm of the beam to core VDF ratio.
- Return type:
pd.Series
Notes
This routine was written for Faraday cup data quality validation, so alpha particle velocities are projected with by \(\sqrt{2.0}\) to the velocity window in which they are measured.
- estimate_electrons(inplace=False)[source]ο
Estimate the electron parameters with a scalar temperature.
Assume temperature is the same as proton scalar temerature.
- heat_flux(*species)[source]ο
Calculate the parallel heat flux.
\(Q_\parallel = \rho (v^3 + \frac{3}{2}vw^2)\)
where \(v\) is each speciesβ velocity in the Center-of-Mass frame and \(w\) is each species parallel thermal speed.
- Parameters:
species (list of strings) β The species to use. If a sum is indicated, take the sum of the input species.
- Returns:
q β Dimensionality depends on species inputs.
- Return type:
pd.Series or pd.DataFrame
- qpar(*species)[source]ο
Shortcut to
heat_flux().
- build_alfvenic_turbulence(species, **kwargs)[source]ο
Create an Alfvenic turbulence instance.
- Parameters:
species (str) β Species identifier. When no , present, use center-of-mass velocity as the velocity term. Alternatively, may contain up to one ,. This is a unique Plasma case in which s0+s1,s0+s1+s2 is a valid identifier. Here, the 2nd species is treated as the mass density passed to AlfvenTurbulence and used for converting magentic field in Alfven units.
kwargs β Passed to rolling method in
AlfvenicTurbulenceto specify window size.
- S(*species)[source]ο
Shortcut to
specific_entropy().
- specific_entropy(*species)[source]ο
Calculate the specific entropy following [1] as.
\(p_\mathrm{th} \rho^{-\gamma}\)
where \(gamma=5/3\), \(p_\mathrm{th}\) is the thermal presure, and \(rho\) is the mass density.
- Parameters:
species (str or list-like of str) β
Comma separated strings (βa,p1β) are invalid. Comma separated lists (βaβ, βp1β) are valid. Total effective species (βa+p1β) are valid and use
\(p_\mathrm{th} = \sum_s p_{\mathrm{th},s}\) \(\rho = \sum_s \rho_s\).
References
- [1] Siscoe, G. L. (1983). Solar System Magnetohydrodynamics (pp.
11β100). <https://doi.org/10.1007/978-94-009-7194-3_2>.
- kinetic_energy_flux(*species)[source]ο
Calculate the plasma kinetic energy flux.
- Parameters:
species (str) β Each species is a string. If only one string is passed, it can contain β+β. If this is the case, the species are summed over and a pd.Series is returned. Otherwise, the individual quantities are returned as a pd.DataFrame.
- Returns:
rho β See Parameters for more info.
- Return type:
pd.Series or pd.DataFrame
- Wk(*species)[source]ο
Shortcut to
kinetic_energy_flux().
- property constants: Constantsο
Physical constants.
- Returns:
Physical constants instance.
- Return type:
uc.Constants
- property data: DataFrameο
Underlying DataFrame containing the data.
- Returns:
Data with MultiIndex columns.
- Return type:
pd.DataFrame
- head()ο
Return the first few rows of the data.
- Returns:
First few rows of the data.
- Return type:
pd.DataFrame
- static mi_tuples(x: Tuple[Tuple[str, ...], ...]) MultiIndexο
Create a MultiIndex from tuples with appropriate names.
- Parameters:
x (Tuple[Tuple[str, ...], ...]) β Tuples to create MultiIndex from.
- Returns:
MultiIndex created from tuples.
- Return type:
MI
- tail()ο
Return the last few rows of the data.
- Returns:
Last few rows of the data.
- Return type:
pd.DataFrame