Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Aji John
    @ajijohn17_twitter
    thx
    any concept of ternary operators in Python ?
    Kyle Barbary
    @kbarbary
    a = b if condition else c
    Aji John
    @ajijohn17_twitter
    thx
    Jenna Baughman
    @jennabaughman
    i am getting a "None not found" kernel message. I tried changing the kernel to python and restarting it but no change- i can't execute any of the code in the notebook. any ideas?
    Kyle Barbary
    @kbarbary
    Try closing and reopening the notebook. This seemed to work for people having this problem before.
    Jenna Baughman
    @jennabaughman
    so far, no. i restarted terminal and everything. other lecture notebooks are working fine
    Jenna Baughman
    @jennabaughman
    ok if this happens to anyone else: it was notifying me that the notebook version was changed and not to save it if i wanted to preserve the original version. i changed the kernel and saved the notebook then closed and restarted it. maybe that wasn't what fixed it, but it is working now
    Stefan van der Walt
    @stefanv
    @jennabaughman Glad you managed to sort out the problem!
    Jenna Baughman
    @jennabaughman
    yeah, but all the print commands are python 2 style! so maybe the version change was not a good thing. oh well.
    Stefan van der Walt
    @stefanv
    ¯\_(ツ)_/¯
    Michael Medford
    @MichaelMedford

    Why is notebook saying that there are no tests in myfactorial.factorial? I'm running the follow command:

    !python -m doctest -v myfactorial.py

    and it returns:

    3 items had no tests:
    myfactorial
    myfactorial.factorial
    myfactorial.test
    0 tests in 3 items.
    0 passed and 0 failed.
    Test passed.

    Stefan van der Walt
    @stefanv
    What is the content of myfactorial.py?
    Michael Medford
    @MichaelMedford
    Sorry @stefanv , I didn't reload the code in the notebook. Sorry!
    Stefan van der Walt
    @stefanv
    No problem :)
    Signature: np.testing.assert_almost_equal(actual, desired, decimal=7, err_msg='', verbose=True)
    Docstring:
    Raises an AssertionError if two items are not equal up to desired
    precision.
    
    .. note:: It is recommended to use one of `assert_allclose`,
              `assert_array_almost_equal_nulp` or `assert_array_max_ulp`
              instead of this function for more consistent floating point
              comparisons.
    Niwroc
    @Niwroc
    @stefanv A couple other observations. Some of the Ipynb docs from the github deviate from the docs used by instructors making following along difficult. The solutions for the Google Trends homework didn't specify that "plt." was necessary before "plot" to actually render the plot.
    Stefan van der Walt
    @stefanv
    @Niwroc The latter issue is probably due to a change from %pylab inline to %matplotlib inline, which no longer does from matplotlib.pyplot import * by default. We'll have to fix that. Do you mind filing an issue against the github repo at http://github.com/profjsb/python-bootcamp?
    @Niwroc The ipynb notebooks should be pushed up before the lectures. We'll be sure to remind instructors about that.
    aminzargar
    @aminzargar
    i'm having trouble with using filenames. how do i call fizz_buzz.py from test_fizz_buzz.py?
    Kyle Barbary
    @kbarbary
    is it in the same directory?
    aminzargar
    @aminzargar
    i got it now, i forgot about the from/import
    btw, i really like this doing the breakout solution together
    Fernando Perez
    @fperez
    @stefanv, @bnaul: panel starts at 4pm, right? I'll be headed up soon...
    Brett Naul
    @bnaul
    schedule says 4:10 but that sounds good :)
    Fernando Perez
    @fperez
    ok, I'll be up there in a bit, well before 4:10. thx!
    nishantlokhandwala
    @nishantlokhandwala
    can you combine a bunch of row arrays/series to form a data frame? Or does it have to be by column?
    Brett Naul
    @bnaul
    In [3]: pd.DataFrame([{'rainfall': 1.0, 'temp': 2.0}, {'rainfall': 0.0, 'temp': 3.0}])
    Out[3]:
       rainfall  temp
    0       1.0   2.0
    1       0.0   3.0
    nishantlokhandwala
    @nishantlokhandwala
    I see, thanks also are Series the same as arrays? In that their elements can be referenced and changed?
    aminzargar
    @aminzargar
    it is super challenging knownign when to use {}, [], (), [,], [],[]
    Brett Naul
    @bnaul
    @nishantlokhandwala most of the same syntax will work (e.g. my_series[1] = 1.0). if you want the actual numpy.array of underlying values, you can do my_series.values
    nishantlokhandwala
    @nishantlokhandwala
    @bnaul Thank you
    If we calculate mean for a column that has NaN or Inf in it are they ignored or does it throw up an error?
    Brett Naul
    @bnaul
    ?pd.Series.mean, check out skipna.
    nishantlokhandwala
    @nishantlokhandwala
    @bnaul Thanks again!
    Aji John
    @ajijohn17_twitter
    how do I access the index value of a df filter ind = df[df > 0] ind['rainfall']
    Brett Naul
    @bnaul
    @ajijohn17_twitter is this what you mean? df['rainfall'][df['rainfall'] > 0.0]
    Aji John
    @ajijohn17_twitter
    2013-01-01 1.764052
    2013-01-02 1.867558
    2013-01-04 0.761038
    2013-01-05 1.494079
    is the output of the filter, how do I get the date part ? I can get the rainfall by ind['rainfall']
    Brett Naul
    @bnaul
    if you want all the rows where rainfall > 0, you could do df.ix[df['rainfall'] > 0.0]
    if you just want the dates (or index values), you could do df.index[df['rainfall'] > 0.0]
    Aji John
    @ajijohn17_twitter
    perfect, thx
    claiello
    @claiello
    @nishantlokhandwala referring back to your question about NaNs a couple of posts ago: also check numpy.nanmean , numpy.nanmin, numpy.nanmax and so forth
    nishantlokhandwala
    @nishantlokhandwala
    will do, thanks
    samra40390
    @samra40390
    are python modules and packages same ? if not, when you use one over the other ??
    Stefan van der Walt
    @stefanv
    Yes, a package is typically what we call the thing you ship around (a conda package, a wheel), and the module the thing you import. But they typically come one-to-one.
    samra40390
    @samra40390
    thanks
    Kyle Barbary
    @kbarbary
    the numba package I mentioned, for JIT compilation of python code: http://numba.pydata.org/
    aiturrios
    @aiturrios
    Will video of lectures be posted on YouTube?
    Also wanted to say thank you for the 2 days of the bootcamp. Was very insightful.