diff --git a/README.md b/README.md index 12372c8f8..053ca510c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Maintainability](https://api.codeclimate.com/v1/badges/11bf2329590e7b0164ba/maintainability)](https://codeclimate.com/github/hed-standard/hed-python/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/11bf2329590e7b0164ba/test_coverage)](https://codeclimate.com/github/hed-standard/hed-python/test_coverage) ![PyPI - Status](https://img.shields.io/pypi/v/hedtools) - +[![Documentation Status](https://readthedocs.org/projects/hed-python/badge/?version=latest)](https://hed-python.readthedocs.io/en/latest/?badge=latest) # HEDTools - Python HED (Hierarchical Event Descriptors) is a framework for systematically describing diff --git a/docs/requirements.txt b/docs/requirements.txt index 952120af1..59c144b44 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -5,6 +5,7 @@ openpyxl>=3.1.0 pandas>=1.3.5 portalocker>=2.7.0 semantic_version>=2.10.0 +myst-parser>=1.0.0 Sphinx>=5.2.2 sphinx_rtd_theme>=1.0.0 wordcloud==1.9.2 diff --git a/docs/source/_static/images/croppedWideLogo.png b/docs/source/_static/images/croppedWideLogo.png new file mode 100644 index 000000000..2f011f9c6 Binary files /dev/null and b/docs/source/_static/images/croppedWideLogo.png differ diff --git a/docs/source/conf.py b/docs/source/conf.py index 229138018..fbc4813b3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -24,8 +24,8 @@ author = 'HED Working Group' # The full version, including alpha/beta/rc tags -version = '0.0.1' -release = '0.0.1' +version = '0.3.1' +release = '0.3.1' currentdir = os.path.realpath(os.path.dirname(__file__)) diff --git a/docs/source/index.rst b/docs/source/index.rst index 8c90bf837..ee0b056e8 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,6 +1,10 @@ Hierarchical Event Descriptor (HED) Python Tools ================================================ +.. image:: _static/images/croppedWideLogo.png + :width: 220 + :alt: HedLogo + .. sidebar:: **Links** * `PDF docs `_ diff --git a/docs/source/introduction.rst b/docs/source/introduction.rst index f49a7dac5..fbb72f414 100644 --- a/docs/source/introduction.rst +++ b/docs/source/introduction.rst @@ -29,12 +29,19 @@ you can install directly from the `GitHub repository `_ using the following command: +```code >>> pip install git+https://github.com/hed-standard/hed-python.git - +``` Finding help ============ +:Documentation: + + See `HED resources `_ for user documentation and tutorials. + + The `HED online tools `_ provide an easy-to-use interface that requires no programming. + :Mailing lists and forums: * Don't hesitate to ask questions about the python hedtools on `NeuroStars diff --git a/hed/models/base_input.py b/hed/models/base_input.py index 745d40811..4c2e3a7bb 100644 --- a/hed/models/base_input.py +++ b/hed/models/base_input.py @@ -70,14 +70,14 @@ def __init__(self, file, file_type=None, worksheet_name=None, has_column_names=T self._dataframe = None if isinstance(file, pandas.DataFrame): - self._dataframe = file + self._dataframe = file.astype(str) self._has_column_names = self._dataframe_has_names(self._dataframe) elif not file: raise HedFileError(HedExceptions.FILE_NOT_FOUND, "Empty file passed to BaseInput.", file) elif input_type in self.TEXT_EXTENSION: try: self._dataframe = pandas.read_csv(file, delimiter='\t', header=pandas_header, - dtype=str, keep_default_na=True, na_values=None) + dtype=str, keep_default_na=True, na_values=["", "null"]) except Exception as e: raise HedFileError(HedExceptions.INVALID_FILE_FORMAT, str(e), self.name) from e # Convert nan values to a known value diff --git a/hed/schema/hed_schema.py b/hed/schema/hed_schema.py index e5f6c5e62..91a73c8f0 100644 --- a/hed/schema/hed_schema.py +++ b/hed/schema/hed_schema.py @@ -153,6 +153,7 @@ def get_formatted_version(self): Returns: str: A json formatted string of the complete version of this schema including library name and namespace. """ + return json.dumps(self.version) def get_save_header_attributes(self, save_merged=False): diff --git a/hed/tools/util/data_util.py b/hed/tools/util/data_util.py index a6866909c..37562e189 100644 --- a/hed/tools/util/data_util.py +++ b/hed/tools/util/data_util.py @@ -131,13 +131,13 @@ def get_new_dataframe(data): DataFrame: A dataframe containing the contents of the tsv file or if data was a DataFrame to start with, a new copy of the DataFrame. - :raises HedFileError: + :raises HedFileError: - If a filename is given and it cannot be read into a Dataframe. """ if isinstance(data, str): - df = pd.read_csv(data, delimiter='\t', header=0, keep_default_na=False, na_values=",null") + df = pd.read_csv(data, delimiter='\t', header=0, keep_default_na=True, na_values=[",", "null"]) elif isinstance(data, pd.DataFrame): df = data.copy() else: @@ -155,7 +155,7 @@ def get_row_hash(row, key_list): Returns: str: Hash key constructed from the entries of row in the columns specified by key_list. - :raises HedFileError: + :raises HedFileError: - If row doesn't have all of the columns in key_list HedFileError is raised. """ @@ -177,7 +177,7 @@ def get_value_dict(tsv_path, key_col='file_basename', value_col='sampling_rate') Returns: dict: Dictionary with key_col values as the keys and the corresponding value_col values as the values. - :raises HedFileError: + :raises HedFileError: - When tsv_path does not correspond to a file that can be read into a DataFrame. """ @@ -252,7 +252,7 @@ def reorder_columns(data, col_order, skip_missing=True): Returns: DataFrame: A new reordered dataframe. - :raises HedFileError: + :raises HedFileError: - If col_order contains columns not in data and skip_missing is False. - If data corresponds to a filename from which a dataframe cannot be created. @@ -277,7 +277,7 @@ def separate_values(values, target_values): list: Target values present in values. list: Target values missing from values. - Notes: + Notes: - The function computes the set difference of target_cols and base_cols and returns a list of columns of target_cols that are in base_cols and a list of those missing.