I have imported data for basket analysis, where each row of my data represents a shopping basket. I want to import this into a list of tuples, but when I do this I get lots of NaN values, as each list is the length of the maximum basket.
How can I remove these NaN values so I can see each basket correctly?
[['ItemA', 'ItemB', 'ItemC', 'ItemD', nan, nan, ...],
Here is my code so far:
import pandas as pd
data = pd.read_csv('basket_analysis_sample_2_small.csv')
data = data.values.tolist()