Source code for arkouda.util

-from typing import cast, Tuple, Sequence
+import json
+from typing import Sequence, Tuple, cast
 from warnings import warn
-import json
 
 from typeguard import typechecked
 
@@ -347,6 +347,10 @@ 

Source code for arkouda.util

     if len(types) != 1:
         raise TypeError(f"Items must all have same type: {types}")
     t = types.pop()
+
+    if t is list:
+        return [x for lst in items for x in lst]
+
     return (
         t.concat(items, ordered=ordered)
         if hasattr(t, "concat")
@@ -491,8 +495,8 @@ 

Source code for arkouda.util

 @typechecked
 def attach(name: str):
     from arkouda.dataframe import DataFrame
-    from arkouda.pdarrayclass import pdarray
     from arkouda.index import Index, MultiIndex
+    from arkouda.pdarrayclass import pdarray
     from arkouda.series import Series
 
     rep_msg = json.loads(cast(str, generic_msg(cmd="attach", args={"name": name})))
diff --git a/_sources/autoapi/arkouda/dataframe/index.rst.txt b/_sources/autoapi/arkouda/dataframe/index.rst.txt
index 0c72a48e36..531912d842 100644
--- a/_sources/autoapi/arkouda/dataframe/index.rst.txt
+++ b/_sources/autoapi/arkouda/dataframe/index.rst.txt
@@ -177,10 +177,10 @@ Functions
 
    .. py:property:: columns
 
-      A list of column names of the dataframe.
+      An Index where the values are the column names of the dataframe.
 
-      :returns: A list of column names of the dataframe.
-      :rtype: list of str
+      :returns: The values of the index are the column names of the dataframe.
+      :rtype: arkouda.index.Index
 
       .. rubric:: Examples
 
@@ -198,7 +198,7 @@ Functions
       +----+--------+--------+
 
       >>> df.columns
-      ['col1', 'col2']
+      Index(array(['col1', 'col2']), dtype='>> df.columns
-      ['col1', 'col2']
+      Index(array(['col1', 'col2']), dtype='>> df.columns
-      ['col1', 'col2']
+      Index(array(['col1', 'col2']), dtype=' max_list_size.
+
+      .. seealso:: :obj:`MultiIndex`
+
+      .. rubric:: Examples
+
+      >>> ak.Index([1, 2, 3])
+      Index(array([1 2 3]), dtype='int64')
+
+      >>> ak.Index(list('abc'))
+      Index(array(['a', 'b', 'c']), dtype='>> ak.Index([1, 2, 3], allow_list=True)
+      Index([1, 2, 3], dtype='int64')
 
    .. py:method:: argsort(ascending=True)
 
@@ -10699,7 +10726,8 @@ Attributes
           file write location or if the mode parameter is neither truncate
           nor append
       :raises TypeError: Raised if any one of the prefix_path, dataset, or mode parameters
-          is not a string
+          is not a string.
+          Raised if the Index values are a list.
 
       .. seealso:: :obj:`save_all`, :obj:`load`, :obj:`read`, :obj:`to_parquet`, :obj:`to_hdf`
 
@@ -10753,13 +10781,14 @@ Attributes
               ------
               ValueError
                   Raised if all datasets are not present in all parquet files or if one or
-                  more of the specified files do not exist
+                  more of the specified files do not exist.
               RuntimeError
                   Raised if one or more of the specified files cannot be opened.
                   If `allow_errors` is true this may be raised if no values are returned
                   from the server.
               TypeError
-                  Raised if we receive an unknown arkouda_type returned from the server
+                  Raised if we receive an unknown arkouda_type returned from the server.
+                  Raised if the Index values are a list.
 
               Notes
               ------
@@ -10794,6 +10823,7 @@ Attributes
       :rtype: string message indicating result of save operation
 
       :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray
+      :raises TypeError: Raised if the Index values are a list.
 
       .. rubric:: Notes
 
@@ -10839,6 +10869,7 @@ Attributes
       :rtype: string message indicating result of save operation
 
       :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray
+      :raises TypeError: Raised if the Index values are a list.
 
       .. rubric:: Notes
 
@@ -11014,7 +11045,7 @@ Attributes
       Currently only aku.ip_address and ak.array are supported.
 
 
-   .. py:method:: to_dict(labels)
+   .. py:method:: to_dict(labels=None)
 
 
    .. py:method:: to_hdf(prefix_path: str, dataset: str = 'index', mode: str = 'truncate', file_type: str = 'distribute') -> str
@@ -11036,7 +11067,7 @@ Attributes
 
       :rtype: string message indicating result of save operation
 
-      :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray
+      :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray.
 
       .. rubric:: Notes
 
@@ -11097,6 +11128,7 @@ Attributes
       :rtype: str - success message if successful
 
       :raises RuntimeError: Raised if a server-side error is thrown saving the index
+      :raises TypeError: Raised if the Index values are a list.
 
       .. rubric:: Notes
 
diff --git a/_sources/autoapi/arkouda/index/index.rst.txt b/_sources/autoapi/arkouda/index/index.rst.txt
index 9067bf30a9..24638fc004 100644
--- a/_sources/autoapi/arkouda/index/index.rst.txt
+++ b/_sources/autoapi/arkouda/index/index.rst.txt
@@ -18,7 +18,7 @@ Classes
 
 
 
-.. py:class:: Index(values: Union[List, arkouda.pdarrayclass.pdarray, arkouda.Strings, arkouda.Categorical, pandas.Index, Index], name: Optional[str] = None)
+.. py:class:: Index(values: Union[List, arkouda.pdarrayclass.pdarray, arkouda.Strings, arkouda.Categorical, pandas.Index, Index], name: Optional[str] = None, allow_list=False, max_list_size=1000)
 
 
    .. py:property:: index
@@ -36,7 +36,34 @@ Classes
    .. py:attribute:: objType
       :value: 'Index'
 
-      
+      Sequence used for indexing and alignment.
+
+      The basic object storing axis labels for all DataFrame objects.
+
+      :param values:
+      :type values: List, pdarray, Strings, Categorical, pandas.Index, or Index
+      :param name: Name to be stored in the index.
+      :type name: str, default=None
+      :param allow_list = False: If False, list values will be converted to a pdarray.
+                                 If True, list values will remain as a list, provided the data length is less than max_list_size.
+      :param : If False, list values will be converted to a pdarray.
+               If True, list values will remain as a list, provided the data length is less than max_list_size.
+      :param max_list_size = 1000: This is the maximum allowed data length for the values to be stored as a list object.
+
+      :raises ValueError: Raised if allow_list=True and the size of values is > max_list_size.
+
+      .. seealso:: :obj:`MultiIndex`
+
+      .. rubric:: Examples
+
+      >>> ak.Index([1, 2, 3])
+      Index(array([1 2 3]), dtype='int64')
+
+      >>> ak.Index(list('abc'))
+      Index(array(['a', 'b', 'c']), dtype='>> ak.Index([1, 2, 3], allow_list=True)
+      Index([1, 2, 3], dtype='int64')
 
    .. py:method:: argsort(ascending=True)
 
@@ -132,7 +159,8 @@ Classes
           file write location or if the mode parameter is neither truncate
           nor append
       :raises TypeError: Raised if any one of the prefix_path, dataset, or mode parameters
-          is not a string
+          is not a string.
+          Raised if the Index values are a list.
 
       .. seealso:: :obj:`save_all`, :obj:`load`, :obj:`read`, :obj:`to_parquet`, :obj:`to_hdf`
 
@@ -186,13 +214,14 @@ Classes
               ------
               ValueError
                   Raised if all datasets are not present in all parquet files or if one or
-                  more of the specified files do not exist
+                  more of the specified files do not exist.
               RuntimeError
                   Raised if one or more of the specified files cannot be opened.
                   If `allow_errors` is true this may be raised if no values are returned
                   from the server.
               TypeError
-                  Raised if we receive an unknown arkouda_type returned from the server
+                  Raised if we receive an unknown arkouda_type returned from the server.
+                  Raised if the Index values are a list.
 
               Notes
               ------
@@ -227,6 +256,7 @@ Classes
       :rtype: string message indicating result of save operation
 
       :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray
+      :raises TypeError: Raised if the Index values are a list.
 
       .. rubric:: Notes
 
@@ -272,6 +302,7 @@ Classes
       :rtype: string message indicating result of save operation
 
       :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray
+      :raises TypeError: Raised if the Index values are a list.
 
       .. rubric:: Notes
 
@@ -407,7 +438,7 @@ Classes
       Currently only aku.ip_address and ak.array are supported.
 
 
-   .. py:method:: to_dict(labels)
+   .. py:method:: to_dict(labels=None)
 
 
    .. py:method:: to_hdf(prefix_path: str, dataset: str = 'index', mode: str = 'truncate', file_type: str = 'distribute') -> str
@@ -429,7 +460,7 @@ Classes
 
       :rtype: string message indicating result of save operation
 
-      :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray
+      :raises RuntimeError: Raised if a server-side error is thrown saving the pdarray.
 
       .. rubric:: Notes
 
@@ -490,6 +521,7 @@ Classes
       :rtype: str - success message if successful
 
       :raises RuntimeError: Raised if a server-side error is thrown saving the index
+      :raises TypeError: Raised if the Index values are a list.
 
       .. rubric:: Notes
 
diff --git a/autoapi/arkouda/dataframe/index.html b/autoapi/arkouda/dataframe/index.html
index c4c56c1c05..64ac4f3aab 100644
--- a/autoapi/arkouda/dataframe/index.html
+++ b/autoapi/arkouda/dataframe/index.html
@@ -642,13 +642,13 @@ 

Functions
property columns#
-

A list of column names of the dataframe.

+

An Index where the values are the column names of the dataframe.

Returns:
-

A list of column names of the dataframe.

+

The values of the index are the column names of the dataframe.

Return type:
-

list of str

+

arkouda.index.Index

Examples

@@ -679,7 +679,7 @@

Functions
>>> df.columns
-['col1', 'col2']
+Index(array(['col1', 'col2']), dtype='<U0')
 

diff --git a/autoapi/arkouda/index.html b/autoapi/arkouda/index.html index ffc26825a3..9f6b697497 100644 --- a/autoapi/arkouda/index.html +++ b/autoapi/arkouda/index.html @@ -1954,13 +1954,13 @@

Attributes
property columns#
-

A list of column names of the dataframe.

+

An Index where the values are the column names of the dataframe.

Returns:
-

A list of column names of the dataframe.

+

The values of the index are the column names of the dataframe.

Return type:
-

list of str

+

arkouda.index.Index

Examples

@@ -1991,7 +1991,7 @@

Attributes
>>> df.columns
-['col1', 'col2']
+Index(array(['col1', 'col2']), dtype='<U0')
 

@@ -5739,13 +5739,13 @@

Attributes
property columns#
-

A list of column names of the dataframe.

+

An Index where the values are the column names of the dataframe.

Returns:
-

A list of column names of the dataframe.

+

The values of the index are the column names of the dataframe.

Return type:
-

list of str

+

arkouda.index.Index

Examples

@@ -5776,7 +5776,7 @@

Attributes
>>> df.columns
-['col1', 'col2']
+Index(array(['col1', 'col2']), dtype='<U0')
 

@@ -16364,7 +16364,7 @@

Attributes
-class arkouda.Index(values: List | arkouda.pdarrayclass.pdarray | arkouda.Strings | arkouda.Categorical | pandas.Index | Index, name: str | None = None)[source]#
+class arkouda.Index(values: List | arkouda.pdarrayclass.pdarray | arkouda.Strings | arkouda.Categorical | pandas.Index | Index, name: str | None = None, allow_list=False, max_list_size=1000)[source]#
property index#
@@ -16386,7 +16386,48 @@

Attributes
objType = 'Index'#
-

+

Sequence used for indexing and alignment.

+

The basic object storing axis labels for all DataFrame objects.

+
+
Parameters:
+
    +
  • values (List, pdarray, Strings, Categorical, pandas.Index, or Index) –

  • +
  • name (str, default=None) – Name to be stored in the index.

  • +
  • False (allow_list =) – If False, list values will be converted to a pdarray. +If True, list values will remain as a list, provided the data length is less than max_list_size.

  • +
+
+
+
+
:paramIf False, list values will be converted to a pdarray.

If True, list values will remain as a list, provided the data length is less than max_list_size.

+
+
+
+
Parameters:
+

1000 (max_list_size =) – This is the maximum allowed data length for the values to be stored as a list object.

+
+
Raises:
+

ValueError – Raised if allow_list=True and the size of values is > max_list_size.

+
+
+
+

See also

+

MultiIndex

+
+

Examples

+
>>> ak.Index([1, 2, 3])
+Index(array([1 2 3]), dtype='int64')
+
+
+
>>> ak.Index(list('abc'))
+Index(array(['a', 'b', 'c']), dtype='<U0')
+
+
+
>>> ak.Index([1, 2, 3], allow_list=True)
+Index([1, 2, 3], dtype='int64')
+
+
+
@@ -16514,7 +16555,8 @@

Attributes
ValueError

Raised if all datasets are not present in all parquet files or if one or -more of the specified files do not exist

+more of the specified files do not exist.

RuntimeError

Raised if one or more of the specified files cannot be opened. If allow_errors is true this may be raised if no values are returned from the server.

-
TypeError

Raised if we receive an unknown arkouda_type returned from the server

+
TypeError

Raised if we receive an unknown arkouda_type returned from the server. +Raised if the Index values are a list.