0

I have a dataframe that is generated, and using weighted_sample, it extracts 6 numbers based on the likelihood it'll appear (Frequency). An example is below:

Numbers  Frequency
      40   2.141527
      25   1.675978
      42   2.793296
      29   1.769087
       5   2.141527
      39   1.862197

I want to take the above random numbers that are generated, and put them into a print() statement where it is up to date with whatever 6 random numbers are generated each time. I just don't want it in the table format, if that makes sense - just the 6 numbers.

4
  • Convert the numbers in the table column to a list. Commented Sep 20, 2022 at 0:24
  • print(list(df['animal'].head(6))) or print(list(df['animal'].tail(6))) Commented Sep 20, 2022 at 0:26
  • @Luis the OP specifically said they don't want it in table format... Commented Sep 20, 2022 at 0:26
  • Thanks, @MattDMo, I forgot to put a list there. Regards. Commented Sep 20, 2022 at 0:31

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.