pythonpandasnumpyexploratory-data-analysis

i have 18126 rows × 63 columns but when i do { data.columns } it shows only 49


There are 63 columns but it shows only 49 columns:

enter image description here

enter image description here


Solution

  • No you have 63 columns. You have multiple times 39 (x7) and 45 (x8)

    Try:

    >>> len(df.columns)
    

    Remove the prefix number of the question to be not confused:

    df.columns = df.columns.str.replace('^\d+\.\s+', '')
    

    Some questions are the same:

    '39. How much debt does your household have? [Car loans]',
    '39. How much debt does your household have? [Credit Cards]',
    '39. How much debt does your household have? [Medical Loans]',
    '39. How much debt does your household have? [Mortgages]',
    '39. How much debt does your household have? [Payday Loans]',
    '39. How much debt does your household have? [Student Loans]',
    '39. How much debt does your household have? [Other]',
    
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Earnings]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Benefits]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Job security]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Work-life balance]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Professional growth or leadership opportunities]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Workplace/company culture]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Diverse and inclusive work environment]',
    '45. Please tell us how satisfied you are with each of these following aspects of your present job [Weekly workload]',