You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@arrow.apache.org by "Igor Tavares (Jira)" <ji...@apache.org> on 2019/10/07 15:29:00 UTC

[jira] [Created] (ARROW-6805) Should the new field_ argument on Table.set_column() be optional? (Unnecessary breaking change)

Igor Tavares created ARROW-6805:
-----------------------------------

             Summary: Should the new field_ argument on Table.set_column() be optional? (Unnecessary breaking change)
                 Key: ARROW-6805
                 URL: https://issues.apache.org/jira/browse/ARROW-6805
             Project: Apache Arrow
          Issue Type: Bug
          Components: Python
    Affects Versions: 0.15.0
         Environment: All
            Reporter: Igor Tavares


The new *field_* argument (Table.set_column() on version 0.15.0) helps to add extra information on the column metadata. But it should not be mandatory, in some cases it is simply redundant like that:

 
{code:python}
import pandas as pd
import pyarrow as pa


df = pd.DataFrame({"foo": [1, 2, 3]})
tbl = pa.Table.from_pandas(df=df, preserve_index=False)

if pa.__version__ == "0.15.0":
    field = pa.field(name="foo", type="double")
    tbl = tbl.set_column(0, field, tbl.column("foo").cast("double"))
else:
    tbl = tbl.set_column(0, tbl.column("foo").cast("double"))
{code}


I think that this argument should be optional to avoid redundant code and to keep compatibility with version <0.15.0. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)