buschbirk / intro-data-capstone-musclehub

0 stars 0 forks source link

Use line breaks to increase readability #7

Closed hillarygreenlerman closed 6 years ago

hillarygreenlerman commented 6 years ago

https://github.com/buschbirk/intro-data-capstone-musclehub/blob/66253a292dbe1c2e164ec5b57ff40c1a6da26ecf/Final%20Analysis/musclehub.py#L213

In Python, we generally want no more than 100 characters per line. Here are a few ways of breaking up long lines of code:

  1. Use \ at the end of a line to break it up:
    df['is_application'] = df.application_date\
    .apply(lambda x: 'Application' if pd.notnull(x) else 'No Application')
  2. Anything within parentheses () can be broken up without a \:
    df['is_application'] = df.application_date.apply(lambda x:
    'Application' if pd.notnull(x) else 'No Application')