Created at 8pm, Jan 4
TailorSoftware Development
0
Python for Economists
C5JPLAxHkcbrzz3GtS0g8RuH2O6p0ua_uSmJezTYuhs
File Type
PDF
Entry Count
212
Embed. Model
jina_embeddings_v2_base_en
Index Type
hnsw
# # True If at least one of them is false, the logical AND comparison returns false: x = True y = False print(x and y) # # False print(y and y) # # False If one of the two compared objects is equal to the empty value (None), then the logical AND comparison returns : the value None if the other object is worth True or None the value False if the other object is worth False. 4.3. LOGICAL OPERATORS x = True y = False z = None print(x and z) # # None print(y and z) # # False print(z and z) # # None 4.3.2 Logical OR The operator or allows logical OR comparisons to be made. Again, we compare two Booleans, x and y. If at least one of the two objects x and y is true, the logical OR comparison returns true: x = True y = False print(x or y) # # True If both are false, the logical OR comparison returns false: x = False y = False print(x or y) 101 102 CHAPTER 4. OPERATORS
id: ae1bb10a5fe2abb74931a0016ee1926c - page: 100
# # False If one of the two objects is None, the logical OR comparison returns : True if the other object is worth True None if the other object is worth False or None. x = True y = False z = None print(x or z) # # True print(y or z) # # None print(z or z) # # None 4.3.3 Logical Not The operator not, when applied to a Boolean, evaluates the latter at its opposite value: x = True y = False print(not x) # # False 4.4. SOME FUNCTIONS print(not y) # # True When using the operator not on an empty value (None), Python returns True: x = None not x # # True 4.4 Some Functions Python has many useful functions for manipulating structures and data. Table 4.2 lists some of them. Some require the loading of the math library, others require the statistics library. We will see other functions specic to the NumPy library in Chapter 9. Table 4.2: Some numerical functions
id: 212dc53e88d781090db60ff78ca2c564 - page: 102
Function math.ceil(x) math.copysign(x, y) math.floor(x) math.round(x, ndigits) math.fabs(x) math.exp(x) math.log(x) math.log(x, b) math.log10(x) math.pow(x,y) math.sqrt(x) math.fsum() Description Smallest integer greater than or equal to x Absolute value of x but with the sign of y Smallest integer less than or equal to x Rounded from x to ndigits decimal places Absolute value of x Exponential of x Natural logarithm of x (based on e) Logarithm based on b of x Logarithm in base 10 of x x high to the power y Square root of x Sum of the values of x 103 104 CHAPTER 4. OPERATORS
id: 44aa645a6717fc5e77d65688481ea00e - page: 103
Function math.sin(x) math.cos(x) math.tan(x) math.asin(x) math.acos(x) math.atan(x) math.sinh(x) math.cosh(x) math.tanh(x) math.asinh(x) math.acosh(x) math.atanh(x) math.degree(x) math.radians(x) math.factorial() math.gcd(x, y) math.isclose(x, y, rel_tol=1e-09, abs_tol=0.0) math.isfinite(x) math.isinf(x) math.isnan(x) statistics.mean(x) statistics.median(x) statistics.mode(x) statistics.stdev(x) statistics.variance(x)
id: f4b99940b3e4cf1e3bc03fec99dcbd1d - page: 104
How to Retrieve?
# Search

curl -X POST "https://search.dria.co/hnsw/search" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"rerank": true, "top_n": 10, "contract_id": "C5JPLAxHkcbrzz3GtS0g8RuH2O6p0ua_uSmJezTYuhs", "query": "What is alexanDRIA library?"}'
        
# Query

curl -X POST "https://search.dria.co/hnsw/query" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"vector": [0.123, 0.5236], "top_n": 10, "contract_id": "C5JPLAxHkcbrzz3GtS0g8RuH2O6p0ua_uSmJezTYuhs", "level": 2}'