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 In this article, we will discuss how an array or list can be passed to a function as a parameter in Python. Pass an array to a function in Python So for instance, if we have thousands of values stored in an array and we want to perform the manipulation of those values in a specific function, that is 4 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 Sum 2D array in Python using map() function Given a 2-D matrix, we need to find sum of all elements present in matrix ? Examples: Input : arr = [[1, 2, 3], [4, 5, 6], [2, 1, 2]] Output : Sum = 26 This problem can be solved easily using two for loops by iterating whole matrix but we can solve this problem quickly in python using map() function 2 min read Python | Pandas Series.from_array() Pandas series is a One-dimensional ndarray with axis labels. The labels need not be unique but must be a hashable type. The object supports both integer- and label-based indexing and provides a host of methods for performing operations involving the index. Pandas Series.from_array() function constru 2 min read NumPy Array in Python NumPy (Numerical Python) is a powerful library for numerical computations in Python. It is commonly referred to multidimensional container that holds the same data type. It is the core data structure of the NumPy library and is optimized for numerical and scientific computation in Python. Table of C 2 min read Python | Pandas Index.data Pandas Index is an immutable ndarray implementing an ordered, sliceable set. It is the basic object which stores the axis labels for all pandas objects. Pandas Index.data attribute return the data pointer of the underlying data of the given Index object. Syntax: Index.data Parameter : None Returns : 2 min read Pandas Functions in Python: A Toolkit for Data Analysis Pandas is one of the most used libraries in Python for data science or data analysis. It can read data from CSV or Excel files, manipulate the data, and generate insights from it. Pandas can also be used to clean data, filter data, and visualize data. Whether you are a beginner or an experienced pro 6 min read Like