import pandas as pd
import numpy as np
df_describe = pd.DataFrame(dataset)
df_describe.describe()
please note that dataset is your np.array to describe.
import pandas as pd
import numpy as np
df_describe = pd.DataFrame('your np.array')
df_describe.describe()
Answer from INNO TECH on Stack Overflow Top answer 1 of 5
72
import pandas as pd
import numpy as np
df_describe = pd.DataFrame(dataset)
df_describe.describe()
please note that dataset is your np.array to describe.
import pandas as pd
import numpy as np
df_describe = pd.DataFrame('your np.array')
df_describe.describe()
2 of 5
37
This is not a pretty solution, but it gets the job done. The problem is that by specifying multiple dtypes, you are essentially making a 1D-array of tuples (actually np.void), which cannot be described by stats as it includes multiple different types, incl. strings.
This could be resolved by either reading it in two rounds, or using pandas with read_csv.
If you decide to stick to numpy:
import numpy as np
a = np.genfromtxt('sample.txt', delimiter=",",unpack=True,usecols=range(1,9))
s = np.genfromtxt('sample.txt', delimiter=",",unpack=True,usecols=0,dtype='|S1')
from scipy import stats
for arr in a: #do not need the loop at this point, but looks prettier
print(stats.describe(arr))
#Output per print:
DescribeResult(nobs=6, minmax=(0.34999999999999998, 0.70999999999999996), mean=0.54500000000000004, variance=0.016599999999999997, skewness=-0.3049304880932534, kurtosis=-0.9943046886340534)
Note that in this example the final array has dtype as float, not int, but can easily (if necessary) be converted to int using arr.astype(int)
Videos
09:49
Descriptive Statistics Using Scipy , Numpy and Pandas in Python ...
05:59
Python Describe Statistics, Exploratory Data Analysis Using Pandas ...
Part 1 : Numpy Introduction and Basic Operations | Numpy ...
30:05
Complete Python NumPy for Data Science in 30 minutes | NumPy Python ...
18:36
Python for Data Analysis: Numpy Arrays - YouTube
SciPy
docs.scipy.org › doc › scipy › reference › generated › scipy.stats.describe.html
describe — SciPy v1.17.0 Manual
>>> import numpy as np >>> from scipy import stats >>> a = np.arange(10) >>> stats.describe(a) DescribeResult(nobs=10, minmax=(0, 9), mean=4.5, variance=9.166666666666666, skewness=0.0, kurtosis=-1.2242424242424244) >>> b = [[1, 2], [3, 4]] >>> stats.describe(b) DescribeResult(nobs=2, minmax=(array([1, 2]), array([3, 4])), mean=array([2., 3.]), variance=array([2., 2.]), skewness=array([0., 0.]), kurtosis=array([-2., -2.]))
GeeksforGeeks
geeksforgeeks.org › numpy › python-numpy
Python NumPy - GeeksforGeeks
A NumPy array is a table of elements (usually numbers) of the same data type, indexed by a tuple of positive integers. Each array has a dtype that defines the type of its elements and how they are stored in memory.
Published March 31, 2026
Real Python
realpython.com › python-statistics
Python Statistics Fundamentals: How to Describe Your Data – Real Python
October 21, 2023 - In this step-by-step tutorial, you'll learn the fundamentals of descriptive statistics and how to calculate them in Python. You'll find out how to describe, summarize, and represent your data visually using NumPy, SciPy, pandas, Matplotlib, and the built-in Python statistics library.
NumPy
numpy.org › doc › stable › reference › arrays.dtypes.html
Data type objects (dtype) — NumPy v2.4 Manual
NumPy data type descriptions are instances of the dtype class. The type of the data is described by the following dtype attributes:
NumPy
numpy.org › doc › stable › user › absolute_beginners.html
NumPy: the absolute basics for beginners — NumPy v2.4 Manual
NumPy (Numerical Python) is an ... engineering. The NumPy library contains multidimensional array data structures, such as the homogeneous, N-dimensional ndarray, and a large library of functions that operate efficiently on these data structures....
NumPy
numpy.org › doc › stable › user › whatisnumpy.html
What is NumPy? — NumPy v2.4 Manual
This last example illustrates two of NumPy’s features which are the basis of much of its power: vectorization and broadcasting. Vectorization describes the absence of any explicit looping, indexing, etc., in the code - these things are taking place, of course, just “behind the scenes” ...
NumPy
numpy.org › devdocs › user › whatisnumpy.html
What is NumPy? — NumPy v2.5.dev0 Manual
This last example illustrates two of NumPy’s features which are the basis of much of its power: vectorization and broadcasting. Vectorization describes the absence of any explicit looping, indexing, etc., in the code - these things are taking place, of course, just “behind the scenes” ...
NumPy
numpy.org › doc › stable
NumPy documentation — NumPy v2.4 Manual
The reference guide contains a detailed description of the functions, modules, and objects included in NumPy. The reference describes how the methods work and which parameters can be used.
Megan Verbakel
mverbakel.github.io › 2021-01-27 › descriptive-stats
Descriptive statistics: Python guide (NumPy/Pandas) | Megan Verbakel
January 27, 2021 - My approach is to first use just ... functions for two common packages: NumPy (for lists/arrays etc.) and Pandas (for dataframes). Descriptive statistics fall into two general categories: 1) Measures of central tendency which describe a ‘typical’ or common value ...
NumPy
numpy.org › devdocs › reference › generated › numpy.ndarray.html
numpy.ndarray — NumPy v2.5.dev0 Manual
class numpy.ndarray(shape, dtype=np.float64, buffer=None, offset=0, strides=None, order=None)[source]# An array object represents a multidimensional, homogeneous array of fixed-size items. An associated data-type object describes the format of each element in the array (its byte-order, how many bytes it occupies in memory, whether it is an integer, a floating point number, or something else, etc.)
Wikipedia
en.wikipedia.org › wiki › NumPy
NumPy - Wikipedia
2 weeks ago - NumPy (pronounced /ˈnʌmpaɪ/ NUM-py) is a library for the Python programming language, adding support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays.
TutorialsPoint
tutorialspoint.com › numpy › numpy_descriptive_statistics.htm
NumPy - Descriptive Statistics
Descriptive statistics in NumPy refers to summarizing and understanding the main features of a dataset through various statistical measures. It includes operations like calculating the mean (average), median, standard deviation, variance, and
Pandas
pandas.pydata.org › docs › reference › api › pandas.DataFrame.describe.html
pandas.DataFrame.describe — pandas 3.0.1 documentation
A list-like of dtypes : Limits the results to the provided data types. To limit the result to numeric types submit numpy.number. To limit it instead to object columns submit the numpy.object data type. Strings can also be used in the style of select_dtypes (e.g. df.describe(include=['O'])).
NumPy
numpy.org › doc › stable › reference › arrays.html
Array objects — NumPy v2.4 Manual
An item extracted from an array, e.g., by indexing, is represented by a Python object whose type is one of the array scalar types built in NumPy. The array scalars allow easy manipulation of also more complicated arrangements of data. Figure Conceptual diagram showing the relationship between the three fundamental objects used to describe the data in an array: 1) the ndarray itself, 2) the data-type object that describes the layout of a single fixed-size element of the array, 3) the array-scalar Python object that is returned when a single element of the array is accessed.#
GeeksforGeeks
geeksforgeeks.org › python › introduction-to-numpy
NumPy Introduction - GeeksforGeeks
2 weeks ago - NumPy(Numerical Python) is a fundamental library for Python numerical computing.
NumPy
numpy.org
NumPy
Powerful N-dimensional arrays Fast ... computing today. Numerical computing tools NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more....