openml/datasets/functions.py
def edit_dataset(
    data_id,
    description=None,
    creator=None,
    contributor=None,
    collection_date=None,
    language=None,
    default_target_attribute=None,
    ignore_attribute=None,
    citation=None,
    row_id_attribute=None,
    original_data_url=None,
    paper_url=None,
) -> int:
    """ Edits an OpenMLDataset.

    In addition to providing the dataset id of the dataset to edit (through data_id),
    you must specify a value for at least one of the optional function arguments,
    i.e. one value for a field to edit.

    This function allows editing of both non-critical and critical fields.
    Critical fields are default_target_attribute, ignore_attribute, row_id_attribute.

     - Editing non-critical data fields is allowed for all authenticated users.
     - Editing critical fields is allowed only for the owner, provided there are no tasks
       associated with this dataset.

    If dataset has tasks or if the user is not the owner, the only way
    to edit critical fields is to use fork_dataset followed by edit_dataset.

    Parameters
    ----------
    data_id : int
        ID of the dataset.
    description : str
        Description of the dataset.
    creator : str
        The person who created the dataset.
    contributor : str
        People who contributed to the current version of the dataset.
    collection_date : str
        The date the data was originally collected, given by the uploader.
    language : str
        Language in which the data is represented.
        Starts with 1 upper case letter, rest lower case, e.g. 'English'.
    default_target_attribute : str
        The default target attribute, if it exists.
        Can have multiple values, comma separated.
    ignore_attribute : str | list
        Attributes that should be excluded in modelling,
        such as identifiers and indexes.
    citation : str
        Reference(s) that should be cited when building on this data.
    row_id_attribute : str, optional
        The attribute that represents the row-id column, if present in the
        dataset. If ``data`` is a dataframe and ``row_id_attribute`` is not
        specified, the index of the dataframe will be used as the
        ``row_id_attribute``. If the name of the index is ``None``, it will
        be discarded.

        .. versionadded: 0.8
            Inference of ``row_id_attribute`` from a dataframe.
    original_data_url : str, optional
        For derived data, the url to the original dataset.
    paper_url : str, optional
        Link to a paper describing the dataset.

    Returns
    -------
    Dataset id
    """
    if not isinstance(data_id, int):
        raise TypeError("`data_id` must be of type `int`, not {}.".format(type(data_id)))

    # compose data edit parameters as xml
    form_data = {"data_id": data_id}
    xml = OrderedDict()  # type: 'OrderedDict[str, OrderedDict]'
    xml["oml:data_edit_parameters"] = OrderedDict()
    xml["oml:data_edit_parameters"]["@xmlns:oml"] = "http://openml.org/openml"
    xml["oml:data_edit_parameters"]["oml:description"] = description
    xml["oml:data_edit_parameters"]["oml:creator"] = creator
    xml["oml:data_edit_parameters"]["oml:contributor"] = contributor
    xml["oml:data_edit_parameters"]["oml:collection_date"] = collection_date
    xml["oml:data_edit_parameters"]["oml:language"] = language
    xml["oml:data_edit_parameters"]["oml:default_target_attribute"] = default_target_attribute
    xml["oml:data_edit_parameters"]["oml:row_id_attribute"] = row_id_attribute
    xml["oml:data_edit_parameters"]["oml:ignore_attribute"] = ignore_attribute
    xml["oml:data_edit_parameters"]["oml:citation"] = citation
    xml["oml:data_edit_parameters"]["oml:original_data_url"] = original_data_url
    xml["oml:data_edit_parameters"]["oml:paper_url"] = paper_url

    # delete None inputs
    for k in list(xml["oml:data_edit_parameters"]):
        if not xml["oml:data_edit_parameters"][k]:
            del xml["oml:data_edit_parameters"][k]

    file_elements = {"edit_parameters": ("description.xml", xmltodict.unparse(xml))}
    result_xml = openml._api_calls._perform_api_call(
        "data/edit", "post", data=form_data, file_elements=file_elements
    )
    result = xmltodict.parse(result_xml)
    data_id = result["oml:data_edit"]["oml:id"]
    return int(data_id)
 Edits an OpenMLDataset.

    In addition to providing the dataset id of the dataset to edit (through data_id),
    you must specify a value for at least one of the optional function arguments,
    i.e. one value for a field to edit.

    This function allows editing of both non-critical and critical fields.
    Critical fields are default_target_attribute, ignore_attribute, row_id_attribute.

     - Editing non-critical data fields is allowed for all authenticated users.
     - Editing critical fields is allowed only for the owner, provided there are no tasks
       associated with this dataset.

    If dataset has tasks or if the user is not the owner, the only way
    to edit critical fields is to use fork_dataset followed by edit_dataset.

    Parameters
    ----------
    data_id : int
        ID of the dataset.
    description : str
        Description of the dataset.
    creator : str
        The person who created the dataset.
    contributor : str
        People who contributed to the current version of the dataset.
    collection_date : str
        The date the data was originally collected, given by the uploader.
    language : str
        Language in which the data is represented.
        Starts with 1 upper case letter, rest lower case, e.g. 'English'.
    default_target_attribute : str
        The default target attribute, if it exists.
        Can have multiple values, comma separated.
    ignore_attribute : str | list
        Attributes that should be excluded in modelling,
        such as identifiers and indexes.
    citation : str
        Reference(s) that should be cited when building on this data.
    row_id_attribute : str, optional
        The attribute that represents the row-id column, if present in the
        dataset. If ``data`` is a dataframe and ``row_id_attribute`` is not
        specified, the index of the dataframe will be used as the
        ``row_id_attribute``. If the name of the index is ``None``, it will
        be discarded.

        .. versionadded: 0.8
            Inference of ``row_id_attribute`` from a dataframe.
    original_data_url : str, optional
        For derived data, the url to the original dataset.
    paper_url : str, optional
        Link to a paper describing the dataset.

    Returns
    -------
    Dataset id
    


This function allows editing of both non-critical and critical fields.

Editing non-critical data fields is allowed for all authenticated users.
Editing critical fields is allowed only for the owner, provided there are no tasks
associated with this dataset.

If dataset has tasks or if the user is not the owner, the only way
to edit critical fields is to use fork_dataset followed by edit_dataset.

Parameters

data_id : int
ID of the dataset.
description : str
Description of the dataset.
creator : str
The person who created the dataset.
contributor : str
People who contributed to the current version of the dataset.
collection_date : str
The date the data was originally collected, given by the uploader.
language : str
Language in which the data is represented.
Starts with 1 upper case letter, rest lower case, e.g. 'English'.
default_target_attribute : str
The default target attribute, if it exists.
Can have multiple values, comma separated.
ignore_attribute : str | list
Attributes that should be excluded in modelling,
such as identifiers and indexes.
citation : str
Reference(s) that should be cited when building on this data.
row_id_attribute : str, optional
The attribute that represents the row-id column, if present in the
dataset.

0.8
Inference of ``row_id_attribute`` from a dataframe.
original_data_url : str, optional
For derived data, the url to the original dataset.
paper_url : str, optional
Link to a paper describing the dataset.

Returns

Dataset id
This function allows editing of both non - critical and critical fields . Editing non - critical data fields is allowed for all authenticated users . Editing critical fields is allowed only for the owner provided there are no tasks associated with this dataset . If dataset has tasks or if the user is not the owner the only way to edit critical fields is to use fork_dataset followed by edit_dataset . Parameters data_id : int ID of the dataset . description : str Description of the dataset . creator : str The person who created the dataset . contributor : str People who contributed to the current version of the dataset . collection_date : str The date the data was originally collected given by the uploader . language : str Language in which the data is represented . Starts with 1 upper case letter rest lower case e . g . ' English ' . default_target_attribute : str The default target attribute if it exists . Can have multiple values comma separated . ignore_attribute : str | list Attributes that should be excluded in modelling such as identifiers and indexes . citation : str Reference ( s ) that should be cited when building on this data . row_id_attribute : str optional The attribute that represents the row - id column if present in the dataset . 0 . 8 Inference of ` ` row_id_attribute ` ` from a dataframe . original_data_url : str optional For derived data the url to the original dataset . paper_url : str optional Link to a paper describing the dataset . Returns Dataset id
def edit_dataset(
    data_id,
    description=None,
    creator=None,
    contributor=None,
    collection_date=None,
    language=None,
    default_target_attribute=None,
    ignore_attribute=None,
    citation=None,
    row_id_attribute=None,
    original_data_url=None,
    paper_url=None,
) -> int:
    if not isinstance(data_id, int):
        raise TypeError("`data_id` must be of type `int`, not {}.".format(type(data_id)))
    form_data = {"data_id": data_id}
    xml = OrderedDict()  
    xml["oml:data_edit_parameters"] = OrderedDict()
    xml["oml:data_edit_parameters"]["@xmlns:oml"] = "http://openml.org/openml"
    xml["oml:data_edit_parameters"]["oml:description"] = description
    xml["oml:data_edit_parameters"]["oml:creator"] = creator
    xml["oml:data_edit_parameters"]["oml:contributor"] = contributor
    xml["oml:data_edit_parameters"]["oml:collection_date"] = collection_date
    xml["oml:data_edit_parameters"]["oml:language"] = language
    xml["oml:data_edit_parameters"]["oml:default_target_attribute"] = default_target_attribute
    xml["oml:data_edit_parameters"]["oml:row_id_attribute"] = row_id_attribute
    xml["oml:data_edit_parameters"]["oml:ignore_attribute"] = ignore_attribute
    xml["oml:data_edit_parameters"]["oml:citation"] = citation
    xml["oml:data_edit_parameters"]["oml:original_data_url"] = original_data_url
    xml["oml:data_edit_parameters"]["oml:paper_url"] = paper_url
    for k in list(xml["oml:data_edit_parameters"]):
        if not xml["oml:data_edit_parameters"][k]:
            del xml["oml:data_edit_parameters"][k]
    file_elements = {"edit_parameters": ("description.xml", xmltodict.unparse(xml))}
    result_xml = openml._api_calls._perform_api_call(
        "data/edit", "post", data=form_data, file_elements=file_elements
    )
    result = xmltodict.parse(result_xml)
    data_id = result["oml:data_edit"]["oml:id"]
    return int(data_id)
def edit_dataset ( data_id , description = None , creator = None , contributor = None , collection_date = None , language = None , default_target_attribute = None , ignore_attribute = None , citation = None , row_id_attribute = None , original_data_url = None , paper_url = None , ) -> int : if not isinstance ( data_id , int ) : raise TypeError ( "`data_id` must be of type `int`, not {}." . format ( type ( data_id ) ) ) form_data = { "data_id" : data_id } xml = OrderedDict ( ) xml [ "oml:data_edit_parameters" ] = OrderedDict ( ) xml [ "oml:data_edit_parameters" ] [ "@xmlns:oml" ] = "http://openml.org/openml" xml [ "oml:data_edit_parameters" ] [ "oml:description" ] = description xml [ "oml:data_edit_parameters" ] [ "oml:creator" ] = creator xml [ "oml:data_edit_parameters" ] [ "oml:contributor" ] = contributor xml [ "oml:data_edit_parameters" ] [ "oml:collection_date" ] = collection_date xml [ "oml:data_edit_parameters" ] [ "oml:language" ] = language xml [ "oml:data_edit_parameters" ] [ "oml:default_target_attribute" ] = default_target_attribute xml [ "oml:data_edit_parameters" ] [ "oml:row_id_attribute" ] = row_id_attribute xml [ "oml:data_edit_parameters" ] [ "oml:ignore_attribute" ] = ignore_attribute xml [ "oml:data_edit_parameters" ] [ "oml:citation" ] = citation xml [ "oml:data_edit_parameters" ] [ "oml:original_data_url" ] = original_data_url xml [ "oml:data_edit_parameters" ] [ "oml:paper_url" ] = paper_url for k in list ( xml [ "oml:data_edit_parameters" ] ) : if not xml [ "oml:data_edit_parameters" ] [ k ] : del xml [ "oml:data_edit_parameters" ] [ k ] file_elements = { "edit_parameters" : ( "description.xml" , xmltodict . unparse ( xml ) ) } result_xml = openml . _api_calls . _perform_api_call ( "data/edit" , "post" , data = form_data , file_elements = file_elements ) result = xmltodict . parse ( result_xml ) data_id = result [ "oml:data_edit" ] [ "oml:id" ] return int ( data_id )
Edits an OpenMLDataset.
Edits an OpenMLDataset .
""" Edits an OpenMLDataset.

    In addition to providing the dataset id of the dataset to edit (through data_id),
    you must specify a value for at least one of the optional function arguments,
    i.e. one value for a field to edit.

    This function allows editing of both non-critical and critical fields.
    Critical fields are default_target_attribute, ignore_attribute, row_id_attribute.

     - Editing non-critical data fields is allowed for all authenticated users.
     - Editing critical fields is allowed only for the owner, provided there are no tasks
       associated with this dataset.

    If dataset has tasks or if the user is not the owner, the only way
    to edit critical fields is to use fork_dataset followed by edit_dataset.

    Parameters
    ----------
    data_id : int
        ID of the dataset.
    description : str
        Description of the dataset.
    creator : str
        The person who created the dataset.
    contributor : str
        People who contributed to the current version of the dataset.
    collection_date : str
        The date the data was originally collected, given by the uploader.
    language : str
        Language in which the data is represented.
        Starts with 1 upper case letter, rest lower case, e.g. 'English'.
    default_target_attribute : str
        The default target attribute, if it exists.
        Can have multiple values, comma separated.
    ignore_attribute : str | list
        Attributes that should be excluded in modelling,
        such as identifiers and indexes.
    citation : str
        Reference(s) that should be cited when building on this data.
    row_id_attribute : str, optional
        The attribute that represents the row-id column, if present in the
        dataset. If ``data`` is a dataframe and ``row_id_attribute`` is not
        specified, the index of the dataframe will be used as the
        ``row_id_attribute``. If the name of the index is ``None``, it will
        be discarded.

        .. versionadded: 0.8
            Inference of ``row_id_attribute`` from a dataframe.
    original_data_url : str, optional
        For derived data, the url to the original dataset.
    paper_url : str, optional
        Link to a paper describing the dataset.

    Returns
    -------
    Dataset id
    """ # compose data edit parameters as xml # type: 'OrderedDict[str, OrderedDict]' # delete None inputs
data_id
description
creator
contributor
collection_date
language
default_target_attribute
ignore_attribute
citation
row_id_attribute
original_data_url
paper_url