iode.Lists.to_series
- Lists.to_series() Series[source]
Create a pandas Series from the current Lists database. The index of the returned Series is build from the Lists names.
See also
Examples
>>> from iode import SAMPLE_DATA_DIR, lists >>> import pandas as pd >>> lists.load(f"{SAMPLE_DATA_DIR}/fun.lst") Loading .../fun.lst 17 objects loaded >>> len(lists) 17
>>> # Export the IODE Lists database as a pandas Series >>> s = lists.to_series() >>> len(s) 17
>>> s.index.to_list() ['COPY', 'COPY0', 'COPY1', ..., 'XSCENARIO', '_SCAL', '_SEARCH'] >>> lists["ENVI"] ['EX', 'PWMAB', 'PWMS', 'PWXAB', 'PWXS', 'QWXAB', 'QWXS', 'POIL', 'NATY', 'TFPFHP_'] >>> s["ENVI"] "['EX', 'PWMAB', 'PWMS', 'PWXAB', 'PWXS', 'QWXAB', 'QWXS', 'POIL', 'NATY', 'TFPFHP_']" >>> lists["MAINEQ"] ['W', 'NFYH', 'KNFF', 'PC', 'PXAB', 'PMAB', 'QXAB', 'QMAB', 'QC_'] >>> s["MAINEQ"] "['W', 'NFYH', 'KNFF', 'PC', 'PXAB', 'PMAB', 'QXAB', 'QMAB', 'QC_']"
>>> # Export a subset of the IODE Lists database as a pandas Series >>> s = lists["E*;MA*"].to_series() >>> len(s) 5
>>> s.index.to_list() ['ENDO', 'ENDO0', 'ENDO1', 'ENVI', 'MAINEQ'] >>> lists["ENVI"] ['EX', 'PWMAB', 'PWMS', 'PWXAB', 'PWXS', 'QWXAB', 'QWXS', 'POIL', 'NATY', 'TFPFHP_'] >>> s["ENVI"] "['EX', 'PWMAB', 'PWMS', 'PWXAB', 'PWXS', 'QWXAB', 'QWXS', 'POIL', 'NATY', 'TFPFHP_']" >>> lists["MAINEQ"] ['W', 'NFYH', 'KNFF', 'PC', 'PXAB', 'PMAB', 'QXAB', 'QMAB', 'QC_'] >>> s["MAINEQ"] "['W', 'NFYH', 'KNFF', 'PC', 'PXAB', 'PMAB', 'QXAB', 'QMAB', 'QC_']"