Aug-24-2022, 05:47 PM
(This post was last modified: Aug-24-2022, 06:03 PM by Yoriz.
Edit Reason: Added code tags
)
PLEASE just read this and help me
so i made this program where i input any csv file that could be imported in the form of a valid dataframe and , assuming the user knows the names of the 2 x and y axis columns i wrote the code as the following
before you check the code , the error is that i used a variable input "i" and let the user input the name of the x axis into it and so in the plot command line , it says "i" is not a dataframe funtion ? why ? i already let the user input "i" as the valid xaxis name from the dataframe
well if my method is wrong then can anyone please suggest another method ? pleaseeee
so i made this program where i input any csv file that could be imported in the form of a valid dataframe and , assuming the user knows the names of the 2 x and y axis columns i wrote the code as the following
before you check the code , the error is that i used a variable input "i" and let the user input the name of the x axis into it and so in the plot command line , it says "i" is not a dataframe funtion ? why ? i already let the user input "i" as the valid xaxis name from the dataframe
well if my method is wrong then can anyone please suggest another method ? pleaseeee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import pandas as pd import matplotlib.pyplot as pl b = input ( 'enter the pathway of your file' ) df = pd.read_csv(b) print (df) def bar() : i = input ( 'enter the name of the x axis' ) l = input ( 'enter the name of the y axis' ) df.plot.bar(df.i,df.l) pl.title( 'record of computer department' ) pl.show() def line() : v = input ( 'enter the name of the x axis' ) z = input ( 'enter the name of the y axis' ) df.plot(df.v,df.z,marker = '*' ) pl.title( 'record of computer department' ) pl.show() print ( 'enter 1 for bar graph' ) print ( 'enter 2 for line graph' ) x = int ( input ( "CHOOSE YOUR GRAPH OF CHOICE" )) if x = = 1 : bar() elif x = = 2 : line() else : print ( 'enter a valid number' ) |