The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Guruprasad B.R. (15) [Avatar] Offline

Which version of Python is preferred for running the sample codes?

In python version 2.7, the below lines fail to execute...

  • cat_data = array(['male', 'female', 'male', 'male', 'female', 'male', 'female', 'female'])

  • categories = unique(data)

  • features["sqrt_Fare"] = sqrt(data["Fare"])

  • i think it will be good if code samples are embedded into the respective chapters along with all relevant 'import' statements mentioned in it.

    henrik.brink (22) [Avatar] Offline

    That example assumes that you've imported everything from pylab:

    from pylab import *

    If you use ipython, you can get all of this with this line instead:

    %pylab inline

    Take a look at the examples in our Github repo for more detailed usage:

    Hope that helps! Otherwise, please copy/paste the error message in here so I can understand it further.

    - Henrik
    Guruprasad B.R. (15) [Avatar] Offline
    the sample code works with this line included:

    from pylab import *

    Thanks for the clarification and the quick response.