About 333,000 results
Open links in new tab
  1. logarithm - Log to the base 2 in python - Stack Overflow

    Sep 15, 2010 · Using numpy: In [1]: import numpy as np In [2]: np.log2? Type: function Base Class: <type 'function'> String Form: <function log2 at 0x03049030> Namespace: Interactive File: c:\python26\lib\site-packages\numpy\lib\ufunclike.py Definition: np.log2(x, y=None) Docstring: Return the base 2 logarithm of the input array, element-wise.

  2. python - Plot logarithmic axes - Stack Overflow

    Nov 26, 2023 · There are a few methods given on this page (semilogx, semilogy, loglog) but they all do the same thing under the hood, which is to call set_xscale('log') (for x-axis) and set_yscale('log') (for y-axis). Moreover, plt.yscale/plt.scale are functions in the state-machine, which make calls to set_yscale/set_xscale on the current Axes objects.

  3. How do you do natural logs (e.g. "ln()") with numpy in Python?

    Numpy seems to take a cue from MATLAB/Octave and uses log to be "log base e" or ln. Also like MATLAB/Octave, Numpy does not offer a logarithmic function for an arbitrary base. If you find log confusing you can create your own object ln that refers to the numpy.log function:

  4. math - Calculate logarithm in python - Stack Overflow

    Nov 17, 2015 · I am wondering why the result of log base 10 (1.5) in python is 0.405465108108 while the real answer is 0.176091259. This is the code that I wrote: import math print math.log(1.5) Can someone tel...

  5. How to log python exception? - Stack Overflow

    May 8, 2017 · The first argument to logging.exception isn't for the exception to log (Python just grabs the one from the current except: block by magic), it's for the message to log before the traceback. Specifying the exception as the message causes it to be converted to a string, which results in the exception message being duplicated.

  6. Python logging - check location of log files? - Stack Overflow

    You should really read the docs, but if you call logging.basicConfig(filename=log_file_name) where log_file_name is the name of the file you want messages written to (note that you have to do this before anything else in logging is called at all), then all messages logged to all loggers (unless some further reconfiguration happens later) will ...

  7. Get logarithm without math log python - Stack Overflow

    Nov 3, 2012 · def my_log(x, base): count = -1 while x > 0: x /= base count += 1 if x == 0: return count print my_log(16, 2) # %timeit %run my_log.py # 1000 loops, best of 3: 321 us per loop which is faster, using the %timeit magic function in iPython to time the execution for comparison.

  8. python - How do I make this LogLog plot? - Stack Overflow

    Jul 28, 2020 · I am new to python and I am trying to create a LogLogPlot, similar to the one in the image below: This plot, as can be seen on the top, is based on the equation y=x^2/(e^x +1). I have found https://

  9. Making Python loggers output all messages to stdout in addition …

    Oct 25, 2018 · All logging output is handled by the handlers; just add a logging.StreamHandler() to the root logger.. Here's an example configuring a stream handler (using stdout instead of the default stderr) and adding it to the root logger:

  10. How do I log from my Python Spark script - Stack Overflow

    I have a Python Spark program which I run with spark-submit. I want to put logging statements in it. logging.info("This is an informative message.") logging.debug("This is a debug message.") I wan...

Refresh