Ë
    èlÖi›  ã                   ó@   — d dl mZ d dlmZ d dlmZ d dlmZmZ dd„Z	y)é    )ÚDecimal©Úformat_decimal)Úutils)ÚMaxÚMinNc                 ód  ‡‡‡‡— t        j                  t        ‰«      j                  | «      t	        ‰«      j                  | «      «      \  }}|s|n
t        |«      }|s|n
t        |«      }t        ||z
  «      }||z  }|gŠt        d|dz   «      D ]  }	|||	z  z   }
‰j                  |
«       Œ t        j                  ‰«      }t        j                  |«      Šdˆfd„	}g Št        dt        ‰«      «      D ]y  }	|	t        ‰«      dz
  k(  }|	dk(  r||k  r ||‰|	   |¬«      }n<|	t        ‰«      dz
  k(  r||kD  r |‰|	dz
     ||¬«      }n |‰|	dz
     ‰|	   |¬«      }‰j                  |«       Œ{ ‰j                  d«       ˆˆˆfd„}| j                  |‰¬«      }|j                  ˆˆfd„«      S )	aß  
    Generates (approximately) evenly sized bins for the values in a column.
    Bins may not be perfectly even if the spread of the data does not divide
    evenly, but all values will always be included in some bin.

    The resulting table will have two columns. The first will have
    the same name as the specified column, but will be type :class:`.Text`.
    The second will be named :code:`count` and will be of type
    :class:`.Number`.

    :param column_name:
        The name of the column to bin. Must be of type :class:`.Number`
    :param count:
        The number of bins to create. If not specified then each value will
        be counted as its own bin.
    :param start:
        The minimum value to start the bins at. If not specified the
        minimum value in the column will be used.
    :param end:
        The maximum value to end the bins at. If not specified the maximum
        value in the column will be used.
    :returns:
        A new :class:`Table`.
    é   c                 óv   •— t        | ‰¬«      }t        |‰¬«      }|rdnd}||› d|› �z  }||rdz  }|S dz  }|S )N)Úformatú[ú(z - ú]ú)r   )ÚiÚjÚfirst_exclusiveÚlast_exclusiveÚ	inclusiveÚ	exclusiveÚoutputÚbreak_formatters          €úU/var/www/html/strategist-ai/venv_dbt/lib/python3.12/site-packages/agate/table/bins.pyÚname_binzbins.<locals>.name_bin:   sY   ø€ Ü" 1¨_Ô=ˆ	Ü" 1¨_Ô=ˆ	á'‘¨SˆØ�Y�K˜s 9 +Ð.Ñ.ˆØ™�#Ñ0ˆàˆð .1Ñ0ˆàˆó    )r   Nc                 ó~   •— | ‰   }|€y d}	 |‰|   k\  r|dz  }|‰|   k\  rŒ‰|dz
     S # t         $ r |dz  }Y Œw xY w)Nr
   )Ú
IndexError)ÚrowÚvaluer   Ú	bin_namesÚbreaksÚcolumn_names      €€€r   Úbinnerzbins.<locals>.binnerV   sm   ø€ Ø�KÑ ˆàˆ=Øàˆð	Ø˜6 !™9Ò$Ø�Q‘�ð ˜6 !™9Ó$ð
 ˜˜Q™ÑÐøô ò 	Ø�‰FŠAð	ús   �+ «<»<)Úkey_namec                 ó,   •— ‰j                  | ‰   «      S )N)Úindex)Úrr    r"   s    €€r   ú<lambda>zbins.<locals>.<lambda>j   s   ø€  I§O¡O°A°k±NÓ$C€ r   )TF)r   Úround_limitsr   Úrunr   r   ÚabsÚrangeÚappendÚmax_precisionÚmake_number_formatterÚlenÚpivotÚorder_by)Úselfr"   ÚcountÚstartÚendÚminimumÚmaximumÚspreadÚsizer   ÚtopÚdecimal_placesr   r   Únamer#   Útabler    r   r!   s    `               @@@r   Úbinsr?   	   sº  û€ ô2 ×)Ñ)ÜˆKÓ×Ñ˜TÓ"ÜˆKÓ×Ñ˜TÓ"óÑ€GˆWñ
 !‰G¤g¨e£n€EÙ‰'¤'¨#£,€Cô ��u‘Ó€FØ�E‰>€DàˆW€Fô �1�e˜a‘iÓ ò ˆØ�t˜a‘xÑ ˆà�‰�cÕðô ×(Ñ(¨Ó0€NÜ×1Ñ1°.ÓA€Oõð €Iä�1”c˜&“kÓ"ò 
ˆØœs 6›{¨Q™Ñ.ˆà�Š6�g ’oÙ˜G V¨A¡Y¸~ÔN‰DØ”#�f“+ ‘/Ò! g°¢mÙ˜F 1 q¡5™M¨7À>ÔR‰Dá˜F 1 q¡5™M¨6°!©9À^ÔTˆDà×Ñ˜Õð
ð ×Ñ�TÔö ð" �J‰J�v¨ˆJÓ4€Eð �>‰>ÔCÓDÐDr   )é
   NN)
Údecimalr   Úbabel.numbersr   Úagater   Úagate.aggregationsr   r   r?   © r   r   ú<module>rF      s   ðÝ å (å ß 'ôaEr   