0

I am a beginner and I'm trying to make a recommender system, trying to make this pivot table by running this code

import pandas as pd
resumeDataSet = pd.read_csv('resume_test.csv')

#skills
data = resumeDataSet['primary_skills'].nunique()

table = pd.pivot_table(data=data, columns=resumeDataSet['fname'])

I have tried removing the columns, tried switching it to index, tried to leave it blank
can someone tell me what I'm doing wrong here?

I'm getting this error

c:\Users\AHarith\work\job.ipynb Cell 7' in <cell line: 7>()
      4 #skills
      5 data = resumeDataSet['primary_skills'].nunique()
----> 7 table = pd.pivot_table(data=data, columns=resumeDataSet['fname'])

File ~\anaconda3\envs\amoeba\lib\site-packages\pandas\core\reshape\pivot.py:95, in pivot_table(data, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name, observed, sort)
     92     table = concat(pieces, keys=keys, axis=1)
     93     return table.__finalize__(data, method="pivot_table")
---> 95 table = __internal_pivot_table(
     96     data,
     97     values,
     98     index,
     99     columns,
    100     aggfunc,
    101     fill_value,
    102     margins,
    103     dropna,
    104     margins_name,
    105     observed,
    106     sort,
    107 )
    108 return table.__finalize__(data, method="pivot_table")

File ~\anaconda3\envs\amoeba\lib\site-packages\pandas\core\reshape\pivot.py:156, in __internal_pivot_table(data, values, index, columns, aggfunc, fill_value, margins, dropna, margins_name, observed, sort)
    153         data = data[to_filter]
    155 else:
--> 156     values = data.columns
    157     for key in keys:
    158         try:

AttributeError: 'int' object has no attribute 'columns' ```
  • Hi. Please take the time to read this post on [how to provide a great pandas example](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) as well as how to provide a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve) and revise your question accordingly. These tips on [how to ask a good question](http://stackoverflow.com/help/how-to-ask) may also be useful. – jezrael Mar 24 '22 at 05:55

0 Answers0