Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lab_customer_analysis_round1] leonardo_pagliacci #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

leonardo-pagliacci
Copy link

Lab 1 - Customer Analysis Round 1 - Leonardo Pagliacci solutions.

@pt-data-ta-lis
Copy link

pt-data-ta-lis commented Oct 11, 2023

Good Job!

Comments:

  • Rearrange the columns in the dataframe as needed
    cus_data2 = cus_data2[cus_data1.columns] # Changing the order of the columns
    cus_data3 = cus_data3.rename(columns={'state':'st'}) # renaming the column 'state'
    cus_data3 = cus_data3[cus_data1.columns] # Changing the order of the columns

  • Which columns are numerical?
    data.select_dtypes('float')

  • Which columns are categorial?
    data.select_dtypes('object')

  • Delete the column education, a number_of_open_complaints from the dataframe
    data = data.drop(['education', 'number_of_open_complaints'], axis=1)

  • Correct the values in the column customer_lifetime_value. They are given as percent, so multiply them by 100 and change dtype to numerical type
    cus_data['customer_lifetime_value'] = cus_data['customer_lifetime_value'].astype(str) --> This one line isn't useful, if you look at the dtype of this column is "object" so it's either a str or NaN and NaN values (Not a Number) cannot be directly converted to strings because they are a specific type of value used to represent an error condition or an undefined result. Trying to convert NaN directly into a string would not provide meaningful information about the error or the context in which it occurred.
    data['customer_lifetime_value'] = data['customer_lifetime_value']*100
    data['customer_lifetime_value'] = pd.to_numeric(data['customer_lifetime_value'], errors='coerce')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants