Pandas Bar Graph automate split

Hey guys I am trying to genera some graphs with pandas , and the problem I have is that the values have a huge range(from 7 to 7000) is there a way to automatically split my data frame in two when the current value is 10 times bigger then the initial value from the frame ? (eg : if it starts from 7 anything over 70 will go on another graph , then it start from 70 anything bigger that 700 like a recursive function) Thanks a lot !

def PrintPlot (  fileCsv,**kwargs):'bmh')
    df = pd.read_csv(fileCsv)

    df["Benchmark"]=df['Benchmark'].apply(lambda t: t[19:])
    df["Score"]=df['Score'].apply(lambda t:float(t.replace(",",".")))

    df= df[:4]

    x = df['Benchmark']
    y = df['Score']

                     index = False)

    plt.xlabel('test', fontsize=18)
    plt.ylabel('ns/unit', fontsize=16), y,color='mcbkyrg')

This is the graph

*Added : so if I have a set like this

df = pd.DataFrame([[1, 5], [2, 300], [3,7] ,[4,100],[4,1000],[6,3000]], columns=['A', 'B'])

to get something like this , ho have the data distributed in groups which are more easier to plot together

df1 = pd.DataFrame([[1, 5], [3,7] ], columns=['A', 'B'])
df2 = pd.DataFrame([[2, 300], [4,100] ], columns=['A', 'B'])
df3=pd.DataFrame([[4,1000],[6,3000]], columns=['A', 'B'])

Read more here:

Content Attribution

This content was originally published by Vlad Cofaru at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: