<jupyter_start><jupyter_text>Queries 11may20  From  Q16<jupyter_code>i have noticed that sum and sum() produce different results
 - sum() will provide the total (of a column)
 - sum will provide the sum of each element
coudl you please comment on this, and whether this is tractable in other conditions?<jupyter_output><empty_output><jupyter_text>From the Project<jupyter_code>How would you make this in 1 line?

    df2 = sal[sal['EmployeeName'].str.contains("<NAME>")]
    df2['JobTitle']
Group + Filter

    How would you use a group (year) and filter on the year 2013 ?
df4 = sal[sal['TotalPayBenefits'] == sal['TotalPayBenefits'].min()]
print(df4)

    The output from this is correct but not nicely formatted.
    How can i cahnge the output? is it a different formula, or should i format it?
    
I did not managed to use a lambda expression here:

    ** How many people have the word Chief in their job title? (This is pretty tricky) ** Hint : Create a function and use lambda expression
To get the lenght of the string in a column:
    
    is '.apply(lambda x: len(x))' the only possible method?
    when i tried to apply str.len() the result was not good
    
clarification

    df2 = df[df['col_name'] == sal['col_name'].max()]
    
    this formula works for retreiveing the row that contains the max calue for 'col name'
    I would like to discuss the need for 2x  'df' in the 1st part of the argument as i
    feel i understand 50% of it<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07884097035040431, 'fraction_numerical': 0.013477088948787063, 'mean_word_length': 3.8688524590163933, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '631252', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 461, 'n_tokens_neox': 440, 'n_words': 206, 'path': 'Exercises - Qasim/Queries/Queries 11may20.ipynb', 'repo_name': 'k21k/Python-Notes', 'size': '1493'}