<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ensar ERDOĞAN on Medium]]></title>
        <description><![CDATA[Stories by Ensar ERDOĞAN on Medium]]></description>
        <link>https://medium.com/@erdogan06ensar?source=rss-aed5b5e407af------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*d0p5vXtKrLl4sNxx1FRH3A.jpeg</url>
            <title>Stories by Ensar ERDOĞAN on Medium</title>
            <link>https://medium.com/@erdogan06ensar?source=rss-aed5b5e407af------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 15:54:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@erdogan06ensar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Plotly ile Veri Analizi]]></title>
            <link>https://medium.com/deep-learning-turkiye/plotly-ile-veri-analizi-f5fb39809f3e?source=rss-aed5b5e407af------2</link>
            <guid isPermaLink="false">https://medium.com/p/f5fb39809f3e</guid>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Ensar ERDOĞAN]]></dc:creator>
            <pubDate>Tue, 21 May 2019 08:42:35 GMT</pubDate>
            <atom:updated>2019-07-08T07:12:37.831Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Plotly Python ile kullanılabilecek veri analiz kütüphanesidir. Aşağıda plotly kütüphanesine ait plotlar kullanarak örnek bir veri analizinde bulunacağım.</blockquote><p>Bu kod parçacıklarını sizler de alıp kullanabilirsiniz.</p><p>Kullanılacak olan plotlar aşağıdaki gibidir;</p><ul><li>Line Plot</li><li>Scatter Plot</li><li>Bar Plot</li><li>Pie Plot</li><li>Bubble Plot</li><li>Histograms Plot</li><li>Cumulative Histograms Plot</li><li>WorldCloud</li><li>Box Plot</li><li>Scatter Plot Matrix</li><li>Inset Plot</li><li>3D scatter plot</li></ul><p>Veri analizinde bulunabilmek için öncelikli olarak bir tane veriseti(dataset) seçerek analiz yapılacak veri incelenir. Bu örnekte ben dünyadaki şarap yorumlarını içeren hazır verisetini inceleyeceğim.</p><p>Bu tarz hazır verisetlerine <a href="https://www.kaggle.com/">https://www.kaggle.com/</a> adresinden ulaşabilirsiniz.</p><p>İnceleyeceğim örnek verisetinde aşağıdaki kolonlar bulunmaktadır.</p><p>*country =Üretilen ülke bilgisi<br>*description=Açıklama<br>*designation=Şarap yapılan üzüm bag çeşitleri<br>*points=puan<br>*price=fiyat<br>*province=şarabın geldiği eyalet<br>*region_1=Eyaletteki şarap üreten iller<br>*region_2=Özel üretilen şarap bölgeleri<br>*taster_name=Deneme isimleri<br>*taster_twitter_handle=twiter da geçen isimleri<br>*title<br>*variety=Üzüm Çeşiti<br>*winery=Şarap üretim yeri(Şaraphane)</p><p>Analize başlamadan önce kullanacağımız kütüphaneleri import edelim.</p><pre><br>import matplotlib.pyplot as plt<br><br><em>#plotly library</em><br>import plotly.plotly as py<br>from plotly.offline import init_notebook_mode ,iplot<br>init_notebook_mode(connected=True)<br>import plotly.graph_objs as go<br><br><em>#word cloud</em><br>from wordcloud import WordCloud<br><br><br>import os<br>print(os.listdir(&quot;../input&quot;))<br></pre><p>Verisetimizi import edelim ve tanımlanmamış bir kolonun adını değiştirelim.</p><pre>winemag130_data = pd.read_csv(&quot;../input/winemag-data-130k-v2.csv&quot;)<br>winemag130_data.rename( columns={&#39;Unnamed: 0&#39;:&#39;ID&#39;}, inplace=True )<br><br>winemag150_data = pd.read_csv(&quot;../input/winemag-data_first150k.csv&quot;)<br>winemag150_data.rename( columns={&#39;Unnamed: 0&#39;:&#39;ID&#39;}, inplace=True )</pre><p>Verisetimiz hakkında bilgi alalım. İyi bir analiz için verimiz hakkında bilgimiz olması gerekiyor.</p><pre>winemag130_data.info()</pre><pre>&lt;class &#39;pandas.core.frame.DataFrame&#39;&gt;<br>RangeIndex: 129971 entries, 0 to 129970<br>Data columns (total 14 columns):<br>ID                       129971 non-null int64<br>country                  129908 non-null object<br>description              129971 non-null object<br>designation              92506 non-null object<br>points                   129971 non-null int64<br>price                    120975 non-null float64<br>province                 129908 non-null object<br>region_1                 108724 non-null object<br>region_2                 50511 non-null object<br>taster_name              103727 non-null object<br>taster_twitter_handle    98758 non-null object<br>title                    129971 non-null object<br>variety                  129970 non-null object<br>winery                   129971 non-null object<br>dtypes: float64(1), int64(2), object(11)<br>memory usage: 13.9+ MB</pre><p>Örnek 10 tane verimizi gösterelim.</p><pre>winemag130_data.head(10)</pre><p><strong>Line Plot:</strong></p><p>Verimizin ilk 100 kaydını aldığımız örnek kod bloğu.</p><p>Şarapların puan ve fiyatına göre karşılaştırma.</p><pre>df = winemag130_data.iloc[:100,:]<br><br>import plotly.graph_objs as go<br><br><em># Creating trace1</em><br>trace1 = go.Scatter(<br>                    x = df.ID,<br>                    y = df.points,<br>                    mode = &quot;lines&quot;,<br>                    name = &quot;points&quot;,<br>                    marker = dict(color = &#39;rgba(16, 112, 2, 0.8)&#39;),<br>                    text= df.variety)<br><em># Creating trace2</em><br>trace2 = go.Scatter(<br>                    x = df.ID,<br>                    y = df.price,<br>                    mode = &quot;lines+markers&quot;,<br>                    name = &quot;price&quot;,<br>                    marker = dict(color = &#39;rgba(80, 26, 80, 0.8)&#39;),<br>                    text= df.variety)<br>data = [trace1, trace2]<br>layout = dict(title = &#39;Points and Price vs ID of Top 100 Variety&#39;,<br>              xaxis= dict(title= &#39;ID&#39;,ticklen= 5,zeroline= False)<br>             )<br>fig = dict(data = data, layout = layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZj35739o3hp2DaG8vGxLQ.png" /></figure><p>Unique olan puanları listeliyorum.</p><pre><br>winemag130_data[&quot;points&quot;].unique()</pre><pre>array([ 87,  86,  85,  88,  92,  91,  90,  89,  83,  82,  81,  80, 100,<br>        98,  97,  96,  95,  93,  94,  84,  99])</pre><p><strong>Scatter Plot:</strong></p><p>Puanlarına göre ilk 50 veriyi alarak puanlarına göre fiyat analizi yapıyorum.</p><pre>df87 = winemag130_data[winemag130_data.points == 87].iloc[:50,:]<br>df90 = winemag130_data[winemag130_data.points == 90].iloc[:50,:]<br>df93 = winemag130_data[winemag130_data.points == 93].iloc[:50,:]<br>df96 = winemag130_data[winemag130_data.points == 96].iloc[:50,:]<br>df99 = winemag130_data[winemag130_data.points == 99].iloc[:50,:]<br><br>df = winemag130_data.iloc[:100,:]<br><br>import plotly.graph_objs as go<br><em># creating trace1</em><br>trace1 =go.Scatter(<br>                    x = df87.points,<br>                    y = df.price,<br>                    mode = &quot;markers&quot;,<br>                    name = &quot;87&quot;,<br>                    marker = dict(color = &#39;rgba(255, 128, 255, 0.8)&#39;),<br>                    text= df87.variety)<br><em># creating trace2</em><br>trace2 =go.Scatter(<br>                    x = df90.points,<br>                    y = df.price,<br>                    mode = &quot;markers&quot;,<br>                    name = &quot;90&quot;,<br>                    marker = dict(color = &#39;rgba(240, 128, 255, 0.8)&#39;),<br>                    text= df90.variety)<br><em># creating trace3</em><br>trace3 =go.Scatter(<br>                    x = df93.points,<br>                    y = df.price,<br>                    mode = &quot;markers&quot;,<br>                    name = &quot;93&quot;,<br>                    marker = dict(color = &#39;rgba(255, 128, 2, 0.8)&#39;),<br>                    text= df90.variety)<br><em># creating trace4</em><br>trace4 =go.Scatter(<br>                    x = df96.points,<br>                    y = df.price,<br>                    mode = &quot;markers&quot;,<br>                    name = &quot;96&quot;,<br>                    marker = dict(color = &#39;rgba(255, 128, 2, 0.8)&#39;),<br>                    text= df96.variety)<br><em># creating trace5</em><br>trace5 =go.Scatter(<br>                    x = df99.points,<br>                    y = df.price,<br>                    mode = &quot;markers&quot;,<br>                    name = &quot;99&quot;,<br>                    marker = dict(color = &#39;rgba(0, 255, 200, 0.8)&#39;),<br>                    text= df99.variety)<br>data = [trace1, trace2, trace3,trace4,trace5]<br>layout = dict(title = &#39;Points vs world rank of top 50 points with 87, 90,93,96 and 99 points&#39;,<br>              xaxis= dict(title= &#39;ID&#39;,ticklen= 5,zeroline= False),<br>              yaxis= dict(title= &#39;Price&#39;,ticklen= 5,zeroline= False)<br>             )<br>fig = dict(data = data, layout = layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AcXsQHMaWuzZT98MEseVcQ.png" /></figure><p><strong>Bar Plot:</strong></p><p>99 puana sahip ilk 50 verinin üzüm çeşitlerine göre fiyat analizini yapıyorum.</p><pre>df99 = winemag130_data[winemag130_data.points == 99].iloc[:50,:]<br><br>import plotly.graph_objs as go<br><em># create trace1 </em><br>trace1 = go.Bar(<br>                x = df99.variety,<br>                y = df99.price,<br>                name = &quot;price&quot;,<br>                marker = dict(color = &#39;rgba(255, 174, 255, 0.5)&#39;,<br>                             line=dict(color=&#39;rgb(0,0,0)&#39;,width=1.5)),<br>                text = df99.region_1)<br><em># create trace2 </em><br>trace2 = go.Bar(<br>                x = df99.variety,<br>                y = df99.points,<br>                name = &quot;points&quot;,<br>                marker = dict(color = &#39;rgba(255, 255, 128, 0.5)&#39;,<br>                              line=dict(color=&#39;rgb(0,0,0)&#39;,width=1.5)),<br>                text = df99.region_1)<br>data = [trace1, trace2]<br>layout = go.Layout(barmode = &quot;group&quot;)<br>fig = go.Figure(data = data, layout = layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tg_3-p8T9URuKP02t-ddhQ.png" /></figure><pre><em>#Plotly bar plot</em><br><br>df87 = winemag130_data[winemag130_data.points == 87].iloc[:10,:]<br><br>import plotly.graph_objs as go<br><br>x = df87.variety<br><br>trace1 = {<br>  &#39;x&#39;: x,<br>  &#39;y&#39;: df87.price,<br>  &#39;name&#39;: &#39;price&#39;,<br>  &#39;type&#39;: &#39;bar&#39;<br>};<br>trace2 = {<br>  &#39;x&#39;: x,<br>  &#39;y&#39;: df87.points,<br>  &#39;name&#39;: &#39;points&#39;,<br>  &#39;type&#39;: &#39;bar&#39;<br>};<br>data = [trace1, trace2];<br>layout = {<br>  &#39;xaxis&#39;: {&#39;title&#39;: &#39;Top 3 universities&#39;},<br>  &#39;barmode&#39;: &#39;relative&#39;,<br>  &#39;title&#39;: &#39;price and points of top 10 variety in 87&#39;<br>};<br>fig = go.Figure(data = data, layout = layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwE8HziYtAFHGalDVTLR3g.png" /></figure><p><strong>Pie Plot:</strong></p><p>87 puana ait 1. veriden 8. veriye kadar olan üzümlerin fiyatlarına göre ortalama analizini yapıyorum.</p><pre>df87 = winemag130_data[winemag130_data.points == 87].iloc[1:8,:]<br><br>value=df87.price<br>labels=df87.title<br><br>fig = {<br>  &quot;data&quot;: [<br>    {<br>      &quot;values&quot;: value,<br>      &quot;labels&quot;: labels,<br>      &quot;domain&quot;: {&quot;x&quot;: [0, .5]},<br>      &quot;name&quot;: &quot;Wine names by price&quot;,<br>      &quot;hoverinfo&quot;:&quot;label+percent+name&quot;,<br>      &quot;hole&quot;: .3,<br>      &quot;type&quot;: &quot;pie&quot;<br>    },],<br>  &quot;layout&quot;: {<br>        &quot;title&quot;:&quot;Wine names by price&quot;,<br>        &quot;annotations&quot;: [<br>            { &quot;font&quot;: { &quot;size&quot;: 20},<br>              &quot;showarrow&quot;: False,<br>              &quot;text&quot;: &quot;Wine Reviews Title&quot;,<br>                &quot;x&quot;: 0.20,<br>                &quot;y&quot;: 1<br>            },<br>        ]<br>    }<br>}<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*huh-Drfy_U7v2FYlpkhebg.png" /></figure><p><strong>Bubble Plot:</strong></p><p>87 puana ait 1&#39;den 21. veriye kadar olan verileri ID ve fiyatına göre veri analizini yapıyorum.</p><pre>df87 = winemag130_data[winemag130_data.points == 87].iloc[1:21,:]<br><br>df=df87.fillna(0)<br><br>color=df.price<br><br>data = [<br>    {<br>        &#39;y&#39;: df.price,<br>        &#39;x&#39;: df.ID,<br>        &#39;mode&#39;: &#39;markers&#39;,<br>        &#39;marker&#39;: {<br>            &#39;color&#39;: color,<br>            &#39;size&#39;: color,<br>            &#39;showscale&#39;: True<br>        },<br>        &quot;text&quot; :  df.variety    <br>    }<br>]<br>iplot(data)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GINbAX4PbXkQZLo6bEMjlA.png" /></figure><p><strong>Histograms Plot:</strong></p><p>96 ve 100 puana ait ilk 50 verinin fiyatına göre analizini yapıyorum.</p><pre>df96 = winemag130_data[winemag130_data.points == 96].iloc[:50,:]<br>df100 = winemag130_data[winemag130_data.points == 100].iloc[:50,:]<br><br>import plotly.graph_objs as go<br><br>trace1 = go.Histogram(<br>    x=df96.price,<br>    opacity=0.75,<br>    name = &quot;96 points&quot;,<br>    marker=dict(color=&#39;rgba(171, 50, 96, 0.6)&#39;))<br>trace2 = go.Histogram(<br>    x=df100.price,<br>    opacity=0.75,<br>    name = &quot;100 points&quot;,<br>    marker=dict(color=&#39;rgba(12, 50, 196, 0.6)&#39;))<br><br>data = [trace1, trace2]<br>layout = go.Layout(barmode=&#39;overlay&#39;,<br>                   title=&#39; Wine Reviews price in 96 and 100 points&#39;,<br>                   xaxis=dict(title=&#39;price&#39;),<br>                   yaxis=dict( title=&#39;Count&#39;),<br>)<br>fig = go.Figure(data=data, layout=layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oZ7ll9d1kki5TfeQEuykZA.png" /></figure><p><strong>Cumulative Histograms Plot:</strong></p><p>87 puana ait ilk 100 kayıtın fiyat artış analizini yapıyorum.</p><pre>df87 = winemag130_data[winemag130_data.points == 87].iloc[:100,:]<br><br>import plotly.graph_objs as go<br><br><br><br>trace2 = go.Histogram(<br>    x=df87.price,<br>    cumulative=dict(enabled=True))<br><br>data = [trace2]<br>layout = go.Layout(barmode=&#39;overlay&#39;,<br>                   title=&#39; Wine Reviews price in 87 points&#39;,<br>                   xaxis=dict(title=&#39;price&#39;),<br>                   yaxis=dict( title=&#39;Count&#39;),<br>)<br>fig = go.Figure(data=data, layout=layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JiZ4PzpnJVNJykSKcFOauQ.png" /></figure><p><strong>WorldCloud:</strong></p><p>87 puana sahip ilk 160 verinin en çok şarap üretilen ülkelerinin gösterimi.</p><pre>df87 = winemag130_data[winemag130_data.points == 87].iloc[:160,:]<br>df87_new=df87.country[df87.points==87]<br><br>plt.subplots(figsize=(10,10))<br>wordcloud = WordCloud(<br>                          background_color=&#39;white&#39;,<br>                          width=512,<br>                          height=384<br>                         ).generate(&quot; &quot;.join(df87_new))<br>plt.imshow(wordcloud)<br>plt.axis(&#39;off&#39;)<br>plt.savefig(&#39;graph.png&#39;)<br><br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*lLYf6bz2Iw9wdYA06UlidA.png" /></figure><p><strong>Box Plot:</strong></p><p>99 ve 100 puana ait ilk 100 verinin ücretlerinin max, min, avg değer analizini yapıyorum.</p><pre>df99 = winemag130_data[winemag130_data.points == 99].iloc[:100,:]<br><br>df100 = winemag130_data[winemag130_data.points == 100].iloc[:100,:]<br><br>trace0 = go.Box(<br>    y=df99.price,<br>    name = &#39;total score of price in 99&#39;,<br>    marker = dict(<br>        color = &#39;rgb(12, 12, 140)&#39;,<br>    )<br>)<br>trace1 = go.Box(<br>    y=df100.price,<br>    name = &#39;research of price in 100&#39;,<br>    marker = dict(<br>        color = &#39;rgb(12, 128, 128)&#39;,<br>    )<br>)<br><br>data = [trace0, trace1]<br>iplot(data)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4I7u_KIgEvaX3l8PygVNpw.png" /></figure><p><strong>Scatter Plot Matrix:</strong></p><p>100 puana ait ilk 100 kaydın birçok plot yardımıyla analizini yapıyorum.</p><pre>df100=winemag150_data[winemag150_data.points == 100].iloc[:100,:]<br><br>import plotly.figure_factory as ff<br><em># prepare data</em><br><br>df100 = df100.loc[:,[&quot;points&quot;,&quot;price&quot;, &quot;ID&quot;]]<br>df100[&quot;index&quot;] = np.arange(1,len(df100)+1)<br><em># scatter matrix</em><br>fig = ff.create_scatterplotmatrix(df100, diag=&#39;box&#39;, index=&#39;index&#39;,colormap=&#39;Portland&#39;,<br>                                  colormap_type=&#39;cat&#39;,<br>                                  height=700, width=700)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*aoabRVjxpBxB4TUWSG7VEw.png" /></figure><p><strong>Inset Plot:</strong></p><p>100 puana ait verilerin ID’lerine göre fiyat analizlerini yapıyorum.</p><pre>df100=winemag150_data[winemag150_data.points == 100]<br><br>trace1 = go.Scatter(<br>    x=df100.ID,<br>    y=df100.price,<br>    name = &quot;price&quot;,<br>    marker = dict(color = &#39;rgba(16, 112, 2, 0.8)&#39;),<br>)<br><em># second line plot</em><br>trace2 = go.Scatter(<br>    x=df100.ID,<br>    y=df100.points,<br>    xaxis=&#39;x2&#39;,<br>    yaxis=&#39;y2&#39;,<br>    name = &quot;points&quot;,<br>    marker = dict(color = &#39;rgba(160, 112, 20, 0.8)&#39;),<br>)<br>data = [trace1, trace2]<br>layout = go.Layout(<br>    xaxis2=dict(<br>        domain=[0.6, 0.95],<br>        anchor=&#39;y2&#39;,        <br>    ),<br>    yaxis2=dict(<br>        domain=[0.6, 0.95],<br>        anchor=&#39;x2&#39;,<br>    ),<br>    title = &#39;Points and Price vs ID of Wine Reviews&#39;<br><br>)<br><br>fig = go.Figure(data=data, layout=layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xManwiFI8VU0AXIZVii0VA.png" /></figure><p><strong>3D scatter plot:</strong></p><p>99 ve 100 puana sahip verilerin fiyat ve puan analizi 3 boyutlu gösterilmekte.</p><pre>df99=winemag150_data[winemag150_data.points == 99]<br>df100=winemag150_data[winemag150_data.points == 100]<br><br>trace1 = go.Scatter3d(<br>    x=df99.ID,<br>    y=df99.price,<br>    z=df99.points,<br>    mode=&#39;markers&#39;,<br>    marker=dict(<br>        size=10,<br>        color=&#39;rgb(255, 0, 0)&#39;,                <em># set color to an array/list of desired values      </em><br>    )<br>)<br>trace2 = go.Scatter3d(<br>    x=df100.ID,<br>    y=df100.price,<br>    z=df100.points,<br>    mode=&#39;markers&#39;,<br>    marker=dict(<br>        size=10,<br>        color=&#39;rgb(127, 127, 127)&#39;,                <em># set color to an array/list of desired values      </em><br>    )<br>)<br><br>data = [trace1,trace2]<br>layout = go.Layout(<br>    margin=dict(<br>        l=0,<br>        r=0,<br>        b=0,<br>        t=0  <br>    )<br>    <br>)<br>fig = go.Figure(data=data, layout=layout)<br>iplot(fig)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cib0ERpMoGaFbNkkASuEFw.png" /></figure><p>Faydası olması dileğiyle. İyi Okumalar.</p><p>Referans : <a href="https://www.kaggle.com/ensarerdogan/plotly-use-for-wine-reviews">https://www.kaggle.com/ensarerdogan/plotly-use-for-wine-reviews</a></p><p>Referans : <a href="https://plot.ly/python/">https://plot.ly/python/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f5fb39809f3e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/deep-learning-turkiye/plotly-ile-veri-analizi-f5fb39809f3e">Plotly ile Veri Analizi</a> was originally published in <a href="https://medium.com/deep-learning-turkiye">Deep Learning Türkiye</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>