#๐Ÿ”’ Help with pd.cut()

5 messages ยท Page 1 of 1 (latest)

umbral girderBOT
#

@fallow spear

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

fallow spear
#

Oh I see the question was deleted as well. It's in the link too, but for initial reading for anyone willing to help:

I have the following script that works mostly, but the banding isnt correct. For example, when creating the 'Bin' column on the values in the column 'BI', value 16.0 should fall into the <17 bin, instead gets a value of NaN. It should include all ages up to 16.99 and not include 17 itself.

#

When running the code, the bin_maxes and bin_labels variables are end up assigned as follows for one of the sheets:

bin_maxes: [16.99, 17.99, 18.99, 19.99, 20.99, 21.99, 22.99, 23.99, 24.99, 25.99, 26.99, 27.99, 28.99, 29.99, 30.99, 31.99, 32.99, 33.99, 34.99, 35.99, 36.99, 37.99, 38.99, 39.99, 40.99, 41.99, 42.99, 43.99, 44.99, 45.99, 46.99, 47.99, 48.99, 49.99, 50.99, 51.99, 52.99, 53.99, 54.99, 55.99, 56.99, 57.99, 58.99, 59.99, 60.99, 61.99, 62.99, 63.99, 64.99, 65.99, 66.99, 67.99, 68.99, 69.99, 70.99, 71.99, 72.99, 73.99, 74.99, 75.99, 76.99, 77.99, 78.99, 79.99, 80.99, 81.99, 82.99, 83.99, 84.99, 85.99, 86.99, 87.99, 88.99, 89.99, 90.99, 91.99, 92.99, 93.99, 94.99, 95.99, 96.99, 97.99, 98.99, 99.99, 100.99, 101.99, 102.99, 103, 100102]

#bin_labels: ['<17', '17 ... 18', '18 ... 19', '19 ... 20', '20 ... 21', '21 ... 22', '22 ... 23', '23 ... 24', '24 ... 25', '25 ... 26', '26 ... 27', '27 ... 28', '28 ... 29', '29 ... 30', '30 ... 31', '31 ... 32', '32 ... 33', '33 ... 34', '34 ... 35', '35 ... 36', '36 ... 37', '37 ... 38', '38 ... 39', '39 ... 40', '40 ... 41', '41 ... 42', '42 ... 43', '43 ... 44', '44 ... 45', '45 ... 46', '46 ... 47', '47 ... 48', '48 ... 49', '49 ... 50', '50 ... 51', '51 ... 52', '52 ... 53', '53 ... 54', '54 ... 55', '55 ... 56', '56 ... 57', '57 ... 58', '58 ... 59', '59 ... 60', '60 ... 61', '61 ... 62', '62 ... 63', '63 ... 64', '64 ... 65', '65 ... 66', '66 ... 67', '67 ... 68', '68 ... 69', '69 ... 70', '70 ... 71', '71 ... 72', '72 ... 73', '73 ... 74', '74 ... 75', '75 ... 76', '76 ... 77', '77 ... 78', '78 ... 79', '79 ... 80', '80 ... 81', '81 ... 82', '82 ... 83', '83 ... 84', '84 ... 85', '85 ... 86', '86 ... 87', '87 ... 88', '88 ... 89', '89 ... 90', '90 ... 91', '91 ... 92', '92 ... 93', '93 ... 94', '94 ... 95', '95 ... 96', '96 ... 97', '97 ... 98', '98 ... 99', '99 ... 100', '100 ... 101', '101 ... 102', '102 ... 103', '103<=']

umbral girderBOT
#

@fallow spear

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.