I am trying to analyze the relationship of difference variables by ploting scatter variables against each other. But error keeps coming up. Here it said ‘ValueError: num must be 1 <= num <= 12, not 0’. I wonder anyother way to plot the scatter or how to fix the problem?
visual_data = pd.read_csv('merge_first_time.csv')
visual_data.Date = pd.to_datetime(visual_data.Date)import numpy as np
import itertools
col_name = list(visual_data.columns)
print(col_name)
visual_data.iloc[:,1]
plt.close('all')
subplot_start = 251
col_number = range(7,len(col_name))
col_pairs = list(itertools.combinations(col_number, 2))
print(col_pairs)
#plt.subplot(subplot_start)
#visual_data.iloc[:,col_pairs[1][0]]
#plt.scatter(visual_data.iloc[:,col_pairs[1][0]],visual_data.iloc[:,col_pairs[1][1]])
print(len(col_pairs))
for i in range(0,len(col_pairs)):
plt.subplot(subplot_start)
plt.scatter(visual_data.iloc[:,col_pairs[i][0]],visual_data.iloc[:,col_pairs[i][1]])
plt.xlabel(col_name[col_pairs[i][0]])
plt.ylabel(col_name[col_pairs[i][1]])
subplot_start += 1
plt.show()
You must select a tag to post in this category. Please find the tag relating to the section of the course you are on E.g. loops, learn-compatibility
When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!
If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer!