0

Couldn't find an answer in previous questions on the subject.

I'm trying to get the minimum value in a column of data, using the following code:

import pandas as pd import matplotlib.pyplot as plt import numpy as np

from tabulate import tabulate as tb from pandas.plotting import scatter_matrix

.......

table = ("Sepal Area (cm^2)", iris_ds.loc[:,"Sepal_area_(cm^2)"].min())
print(tb(table, headers = ["Field", "Min"]))

However, when I run the code, I get the following error:

Traceback (most recent call last):
File "Iris_Data_set1.py", line 148, in print(tb(table, headers = ["Field", "Min"]))
File "C:...\Anaconda3\lib\site-packages\tabulate.py", line 1262, in tabulate tabular_data, headers, showindex=showindex)
File "C:...\Anaconda3\lib\site-packages\tabulate.py", line 947, in _normalize_tabular_data rows = list(map(list,rows)) TypeError: 'numpy.float64' object is not iterable

I've checked the data types, and

Sepal_area_(cm^2) float64

Any ideas on how to fix this

Clauric
  • 1,826
  • 8
  • 29
  • 48
  • you want to print a table where col1 contains the name of the column and col2 the min of all the column is that right ? you table will contain only one row – nassim Apr 25 '19 at 22:05
  • Yes, but eventuality it will have multiple rows and columns – Clauric Apr 26 '19 at 06:34

0 Answers0