0

I have a penguin_size dataset in Python. I have found the minimum value from the 'culmen_length_mm' column. However, I am not sure how to determine which row this minimum value belongs to. Can you help me with this?

import numpy as np
data_set=["culmen_lenght_mm"]
min_index=np.argmin(data_set)
print(min_index)

The result is always returning as 0

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
eesc
  • 1
  • 2
  • Can you give some more details? Example rows in `data_set` and `data_set=["culmen_lenght_mm"]` Could it be that your smallest `culmen_length_mm` happens to be the first entry? – Davo May 14 '23 at 12:15
  • @Davo No, the first row contains a value such as 18.7, which is not the minimum value. The code I wrote earlier was just a trial. In the NumPy library, we can find the minimum value using the min function, but it did not work. – eesc May 14 '23 at 12:22
  • 1
    Your question needs a minimal reproducible example consisting of sample input, expected output, actual output, and only the relevant code necessary to reproduce the problem. See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for best practices related to Pandas questions. – itprorh66 May 14 '23 at 12:53
  • Your code here is using a list of one string. What is `penguin_size` you refer to? – OneCricketeer May 14 '23 at 16:13
  • 1
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 14 '23 at 17:44
  • @OneCricketeer You are correct. 'penguin_size' is a dataset that I downloaded from Kaggle. The code works with arrays, but I don't understand how to use it with datasets – eesc May 15 '23 at 12:14
  • Use read_csv function of pandas? Edit your question to show how you're trying to use that penguin file, or remove from your post, since it's unrelated to the code shown. Then, that also answers why `culmen_lenght_mm` means nothing since you have no columns in the data, only one string – OneCricketeer May 15 '23 at 12:21
  • @OneCricketeer well, i will do what you say :) – eesc May 15 '23 at 12:58

0 Answers0