pandas.array() function in Python Last Updated : 14 Aug, 2020 Comments Improve Suggest changes Like Article Like Report This method is used to create an array from a sequence in desired data type. Syntax : pandas.array(data: Sequence[object], dtype: Union[str, numpy.dtype, pandas.core.dtypes.base.ExtensionDtype, NoneType] = None, copy: bool = True) Parameters : data : Sequence of objects. The scalars inside `data` should be instances of the scalar type for `dtype`. It's expected that `data` represents a 1-dimensional array of data. When `data` is an Index or Series, the underlying array will be extracted from `data`.dtype : tr, np.dtype, or ExtensionDtype, optional. The dtype to use for the array. This may be a NumPy dtype or an extension type registered with pandas.copy : bool, default True. Whether to copy the data, even if not necessary. Depending on the type of `data`, creating the new array may require copying data, even if ``copy=False``. Below is the implementation of the above method with some examples : Example 1 : Python3 # importing packages import pandas # create Pandas array with dtype string pd_arr = pandas.array(data=[1,2,3,4,5],dtype=str) # print the formed array print(pd_arr) Output : <PandasArray> ['1', '2', '3', '4', '5'] Length: 5, dtype: str32 Example 2 : Python3 # importing packages import pandas import numpy # create Pandas array with dtype from numpy pd_arr = pandas.array(data=['1', '2', '3', '4', '5'], dtype=numpy.int8) # print the formed array print(pd_arr) Output : <PandasArray> [1, 2, 3, 4, 5] Length: 5, dtype: int8 Comment More infoAdvertise with us Next Article pandas.array() function in Python D deepanshu_rustagi Follow Improve Article Tags : Python Python-pandas Python pandas-datatypes Practice Tags : python Similar Reads pandas.eval() function in Python This method is used to evaluate a Python expression as a string using various back ends. It returns ndarray, numeric scalar, DataFrame, Series. Syntax : pandas.eval(expr, parser='pandas', engine=None, truediv=True, local_dict=None, global_dict=None, resolvers=(), level=0, target=None, inplace=False) 2 min read Python | Pandas MultiIndex.from_arrays() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas MultiIndex.from_arrays() function is used to convert arrays into MultiIndex. It 2 min read How to pass an array to a function in Python Arrays in Python are implemented using the array module, which allows you to store elements of a specific type. You can pass an entire array to a function to perform various operations.Syntax to create an arrayarray(data_type, value_list)In this article, we'll explore how to pass arrays and lists to 3 min read numpy.pad() function in Python numpy.pad() function is used to pad the Numpy arrays. Sometimes there is a need to perform padding in Numpy arrays, then numPy.pad() function is used. The function returns the padded array of rank equal to the given array and the shape will increase according to pad_width. Syntax: numpy.pad(array, p 2 min read Array in Python | Set 2 (Important Functions) Array in Python | Set 1 (Introduction and Functions)Array in Python | Set 2Below are some more useful functions provided in Python for arrays: Array Typecode FunctionThis function returns the data type by which the array is initialized. In this example, we are using arr.typecode to find out the data 3 min read Like