OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

x values Error when drawing boxplot using FacetGrid in seaborn

  • Thread starter Thread starter joo
  • Start date Start date
J

joo

Guest
enter image description here

There is a table for my work. What I want to do is to draw boxplots for each columns

facet = sns.FacetGrid(df, col='STEP') facet.map_dataframe(sns.boxplot, x='RET', y='QTY') plt.show()

When I used this code, there was an error with the x-values. All charts had the same x-values, which were from the 'TEM0008' column. However, every 'TEM000%' column has different values. enter image description here

I'm trying to fix this code with GPT, but it's not helping..

data = { 'GROUP': ['AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1'], 'NAME': [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4], 'QTY': [56, 56, 56, 56, 56, 56, 56, 56, 43, 43, 43, 43, 43, 43, 43, 43, 55, 55, 55, 55, 55, 55, 55, 55, 50, 50, 50, 50, 50, 50, 50, 50], 'STEP': ['TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008', 'TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008', 'TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008', 'TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008'], 'RET': ['A52', 'B52', 'C52', 'D54', 'E43', 'T56', 'Y67', 'K78', 'B52', 'C32', 'D54', 'E43', 'T44', 'Y66', 'K78', 'B56', 'A22', 'B56', 'C32', 'D33', 'E44', 'T44', 'Y65', 'K90', 'A22', 'B56', 'C4', 'D33', 'E44', 'T55', 'Y66', 'K89'] }

df = pd.DataFrame(data) facet = sns.FacetGrid(df, col='STEP') facet.map_dataframe(sns.boxplot, x='RET', y='QTY') plt.show()

x values for boxplot1(TEM0001 Column) : A52,B52,A22 x values for boxplot2(TEM0002 Column) : B52,C32,B56 x values for boxplot3(TEM0003 Column) : C52,D54,C32,C4
<p><a href="https://i.sstatic.net/ofyMDeA4.png" rel="nofollow noreferrer">enter image description here</a></p>
<p>There is a table for my work. What I want to do is to draw boxplots for each columns</p>
<p><code>facet = sns.FacetGrid(df, col='STEP')</code>
<code>facet.map_dataframe(sns.boxplot, x='RET', y='QTY')</code>
<code>plt.show()</code></p>
<p>When I used this code, there was an error with the x-values. All charts had the same x-values, which were from the 'TEM0008' column. However, every 'TEM000%' column has different values.
<a href="https://i.sstatic.net/0bmRvBpC.png" rel="nofollow noreferrer">enter image description here</a></p>
<p>I'm trying to fix this code with GPT, but it's not helping..</p>
<p><code>data = { 'GROUP': ['AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1', 'AAA1'], 'NAME': [1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4], 'QTY': [56, 56, 56, 56, 56, 56, 56, 56, 43, 43, 43, 43, 43, 43, 43, 43, 55, 55, 55, 55, 55, 55, 55, 55, 50, 50, 50, 50, 50, 50, 50, 50], 'STEP': ['TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008', 'TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008', 'TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008', 'TEM0001', 'TEM0002', 'TEM0003', 'TEM0004', 'TEM0005', 'TEM0006', 'TEM0007', 'TEM0008'], 'RET': ['A52', 'B52', 'C52', 'D54', 'E43', 'T56', 'Y67', 'K78', 'B52', 'C32', 'D54', 'E43', 'T44', 'Y66', 'K78', 'B56', 'A22', 'B56', 'C32', 'D33', 'E44', 'T44', 'Y65', 'K90', 'A22', 'B56', 'C4', 'D33', 'E44', 'T55', 'Y66', 'K89'] }</code></p>
<p><code>df = pd.DataFrame(data)</code>
<code>facet = sns.FacetGrid(df, col='STEP')</code>
<code>facet.map_dataframe(sns.boxplot, x='RET', y='QTY')</code>
<code>plt.show()</code></p>
<p>x values for boxplot1(TEM0001 Column) : A52,B52,A22
x values for boxplot2(TEM0002 Column) : B52,C32,B56
x values for boxplot3(TEM0003 Column) : C52,D54,C32,C4</p>
 
Top