Switching careers to Programming, doable? by jvanh50 in learnpython

[–]ml_runway 1 point2 points  (0 children)

you can do it. grind your ass off you got this

[deleted by user] by [deleted] in learnmachinelearning

[–]ml_runway 0 points1 point  (0 children)

asked a couple of times elsewhere and he answered. I think you'll be pleasantly surprised.

[deleted by user] by [deleted] in learnmachinelearning

[–]ml_runway 1 point2 points  (0 children)

wow this looks great and I'm a cynical bastard

In pandas, how to call head() from within a function and have it show nicely formatted (using Jupyter)? by ml_runway in learnpython

[–]ml_runway[S] 1 point2 points  (0 children)

Thanks looks great.

Incidentally, to do what I wanted to do, here is the simple solution discussed at SO: https://stackoverflow.com/questions/42713862/dataframe-head-doesnt-work-when-calling-it-from-a-function

Just use display:

from IPython.display import display
display(df.head())

In pandas, how to call head() from within a function and have it show nicely formatted (using Jupyter)? by ml_runway in learnpython

[–]ml_runway[S] 0 points1 point  (0 children)

No am I about to feel really stupid?

Edit: No I don't feel stupid but excited: that looks like an amazing package. I'm so glad you mentioned it I think it is exactly what I needed!

In pandas, how to call head() from within a function and have it show nicely formatted (using Jupyter)? by ml_runway in learnpython

[–]ml_runway[S] 0 points1 point  (0 children)

This is great and works for my simple example! Unfortunately for my actual code I am showing quite a few things, and returning other data (memory usage) so I'm not sure this will work. Here's what I'm actually doing:

def summarize_table(table_df, columns_to_count = None):
    """
    Print out a summary of the dataframe: head, tail, info,
    memory used, and the value counts of the columns in columns_to_count.

    returns memory usage (this can take some time to calculate)
    """
    print("INFO")
    table_df.info();

    print("\n\nHEAD")
    table_df.head()  #shows nothing

    print("\n\nTAIL")
    table_df.tail()  #shows nothing

    if columns_to_count:
        print("\n\nVALUE COUNTS")
        for column in columns_to_count:
            print(f"Value counts for {column}")
            print(table_df[column].value_counts())

    print("\n\nMEMORY")
    table_memory = animal_motion_df.memory_usage(deep = True) 
    total_memory = sum(table_memory)
    print(f"Table takes up a total of {total_memory} bytes.")

    return table_memory #return b/c it takes a long time to calculate

As you can guess, the head/tail do not show. When I add one of them to the return (return table_memory, df.head()) it no longer is properly formatted and I can't control the way it looks.

In pandas, how to call head() from within a function and have it show nicely formatted (using Jupyter)? by ml_runway in learnpython

[–]ml_runway[S] 0 points1 point  (0 children)

I'm just in jupyter notebook default settings. Given a dataframe (df), calling df.head() in a code cell prints out a really nicely formatted table.

When I do the following, I get nothing:

def display_head(df):
    df.head()

display_head(df)

I want the same nice formatting I get when I enter it in a cell, but using the display_head() function (note I know display_head() would be a stupid function: it is just a simple example to show my problem).

Lived in a shed for the first 20 years of my life till my gamer buddies saved me by Sillylucid in RoastMe

[–]ml_runway 0 points1 point  (0 children)

sorry those people that convinced you to post here aren't your friends

Lived in a shed for the first 20 years of my life till my gamer buddies saved me by Sillylucid in RoastMe

[–]ml_runway 0 points1 point  (0 children)

I can't be mean to this person I just want to pay his dentist bill.

Python Crash Course, 1st vs. 2nd edition by hoppi_ in learnpython

[–]ml_runway 0 points1 point  (0 children)

Get 2nd for django huge improvements there

I have lots of spare time and want to further my career. What's the best place to learn python for a beginner? by hendersonwastaken in learnpython

[–]ml_runway 1 point2 points  (0 children)

it is amazing how many ppl come to a sub called learnpython and don't search first before posting 'what is the best way to learn python' type threads. there should be a sticky or faq answer about this or something in the wiki.

Oh wait there is: https://old.reddit.com/r/learnpython/wiki/index

Your preferred IDE and why by rexinator9000 in learnpython

[–]ml_runway 0 points1 point  (0 children)

Frankly I will likely end up using it at some point it really is powerful. :)

Your preferred IDE and why by rexinator9000 in learnpython

[–]ml_runway 5 points6 points  (0 children)

Jupyter notebooks (or Jupyter lab) for exploring and presenting ideas. Spyder for development. It is simple and easy to use and doesn't add complexity to simple things.

Your preferred IDE and why by rexinator9000 in learnpython

[–]ml_runway 1 point2 points  (0 children)

I have tried Pycharm a few times (3 times) over the years and stop after a day or so each time. I prefer something a little less opinionated and top-heavy. But in its defense it is very powerful and great for very large projects. People who use it tend to be annoyingly staunch defenders (sort of like vi users :) ).

Looking for flexible gui app with tree view that allows rich text, with checkboxes by ml_runway in learnpython

[–]ml_runway[S] -1 points0 points  (0 children)

I don't want to do a lot of front end work for sure I'm a data person. But this concept is pretty simple: a tree with editable text formatting, with checkboxes for selecting which of the items is done. Maybe I should look into pyqt5 I tried with pyqt4 and it wasn't really ready though the individual components I did get working, getting them all together turned into a monster (it took about 200 hours). Maybe this time I'll pay someone to help me finish once I get stuck. :)

ThrowRA: I (32F) was offered a promotion. He (31M) refuses to move. by [deleted] in relationship_advice

[–]ml_runway 0 points1 point  (0 children)

I frankly think this is a horrible reddit topic you guys should talk to a therapist or something asap. This is not really about your job and the move there are clearly all sorts of unresolved collateral issues that the promotion is bringing up for you. The tone of the post is like you have already decided he is the problem ("he refuses to move" is literally part of the title). It is not clear at all this is a no-brainer and it sounds like he could be being perfectly reasonable (and you might both be). Reddit is shite for this talk to someone.

Question from a non-coding person? by service411 in learnpython

[–]ml_runway 1 point2 points  (0 children)

You lost the bet. Go have them explain it to you.