0

I'm working with 100k Movie Lens dataset, I need to print the entire Table of u.data with NaN values and once again with predicted values. Pandas or Recsys are suitable, others too are welcomed though.

data = pd.read_csv('ml-100k/u.data', sep='\t')
print data

The above code doesn't provide the needful output, since it prints only first and last 30 records. Moreover, I need it foll. format

UserID <MovieID>1   <MovieID>2 <MovieID>3
    1   <Rating>5         NaN          3 
    2        NaN            2          1

I've already been through

  1. This 1 SF Question similar
  2. This 2 Example from AnalyticsVidhya
T3J45
  • 717
  • 3
  • 12
  • 32
  • Hello @jezrael I just followed your answer from a link [link](https://stackoverflow.com/questions/41861846/convert-row-to-column-in-python-pandas) Although I haven't found the correct answer. I feel you can solve this. – T3J45 Jun 26 '17 at 13:46

1 Answers1

0

I am not sure if this is what you were asking but:

To print column names and have UserID as the index just use:

data = pd.read_csv('ml-100k/u.data', sep='\t', names=['UserID','MovieID_1','MovieID_2','MovieID_3']).set_index('UserID')

while for printing the whole dataframe there was a similar question here, where it was suggested to use the option_context from pandas:

with pd.option_context('display.max_rows', None, 'display.max_columns', None):
    print(data)
user9342787
  • 201
  • 2
  • 5