#I have a csv file
! curl -O https://raw.githubusercontent.com/msu-cmse-courses/cmse202-S21-student/master/data/Dataset.data
import pandas as pd
#I read it in.
data = pd.read_csv("Dataset.data", header = None)
data = pd.read_csv("Dataset.data", delimiter=' ', header = None)
#Now I want to add column titles to the file so I add them
data.columns = ['sex','length','diameter','height','whole_weight','shucked_weight','viscera_weight','shell_weight','rings'] print(data)
#Now I want to grab the x variable column 'shell_weight' and the y variable column 'rings' And I want to graph them as a histogram using plt.hexbin.
df = pd.DataFrame(data)
plt.hexbin(x='shell_weight', y='rings')
For Some reason when I graph the code it says First argument must be a sequence and is not working.
Can anyone help me graph these 2 variables. Thanks.
https://stackoverflow.com/questions/66592772/how-to-i-extract-an-x-variable-and-y-variable-from-a-pandas-csv-file-and-graphin March 12, 2021 at 09:07AM
没有评论:
发表评论