<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: htraprocks</title>
    <description>The latest articles on DEV Community by htraprocks (@htraprocks).</description>
    <link>https://dev.to/htraprocks</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F397725%2Fc8e9cb0d-1842-41f1-a527-31666f648e9d.png</url>
      <title>DEV Community: htraprocks</title>
      <link>https://dev.to/htraprocks</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/htraprocks"/>
    <language>en</language>
    <item>
      <title>Help me with Threading in this code. I am unable to figure out how to use threading in this</title>
      <dc:creator>htraprocks</dc:creator>
      <pubDate>Sat, 30 May 2020 16:51:29 +0000</pubDate>
      <link>https://dev.to/htraprocks/help-me-with-threading-in-this-code-i-am-unable-to-figure-out-how-to-use-threading-in-this-28h8</link>
      <guid>https://dev.to/htraprocks/help-me-with-threading-in-this-code-i-am-unable-to-figure-out-how-to-use-threading-in-this-28h8</guid>
      <description>&lt;p&gt;def data_import_date(start_date,end_date):&lt;br&gt;
    end_date1=end_date.strftime('%Y-%m-%dT%H:%M:%S')&lt;br&gt;
    start_date=pd.Timestamp(start_date)&lt;br&gt;
    end_date=pd.Timestamp(end_date1)&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;button=widgets.Button(description='Pull Data')
button.on_click(functools.partial(select_data,rs_=[start_date,end_date]))

vbox=widgets.VBox([button])
display(vbox,out)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;def select_data(b,rs_):&lt;/p&gt;

&lt;h1&gt;
  
  
  clear_output()
&lt;/h1&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;start_date=rs_[0]
end_date1=rs_[1]
print("Data pulling started")

with out:
    clear_output()
    seeq_login() 
    [item1,item2]=query_seeq_for_data()
    i=0
    while True:
        end_date=end_date1.strftime('%Y-%m-%dT%H:%M:%S')
        print("Start &amp;amp; End date: ",start_date,end_date)
        if i==0:
            [X_data,Y_data]=pull_data(item1,item2,start_date,end_date)
        else:
            [X_data_live,Y_data_live]=pull_data(item1,item2,start_date,end_date)
            X_data=X_data.append(X_data_live)
            Y_data=Y_data.append(Y_data_live)
        print("Data pulling completed.\nNow you're ready for your analysis")

        clear_output()
        [X_train,X_test,Y_train,Y_test]=train_test(X_data,Y_data)

        [Xp_train,components,explained_variance_ratio,_,_]=apply_PCA(X_train,X_test)
        plot_PC_variance(X_data,explained_variance_ratio)
        plot_PC(X_data,components)

        time.sleep(20)
        start_date=end_date
        end_date1=end_date1+datetime.timedelta(days=1)
        i+=1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;a=interact(data_import_date,&lt;br&gt;
           start_date=widgets.DatePicker(value=pd.to_datetime(start_date)),&lt;br&gt;
           end_date=widgets.DatePicker(value=pd.to_datetime(end_date)))&lt;/p&gt;

&lt;p&gt;def plot_PC(X_data,components):&lt;br&gt;
    Np_comp=(1,len(X_data.columns),1)&lt;br&gt;
    @interact&lt;br&gt;
    def principal_components(PC1=Np_comp,PC2=Np_comp):&lt;br&gt;
        fig,ax=plt.subplots(1,1,figsize=(10,10))&lt;br&gt;
        plt.figure(5)&lt;br&gt;
        print(PC1, PC2)&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    ax.set_xlabel("Principal Component {}".format(PC1), fontsize=14)
    ax.set_ylabel("Principal Component {}".format(PC2), fontsize=14)
    ax.set_title("Principal components {0} &amp;amp; {1}".format(PC1,PC2), fontsize=(20))
    ax.scatter(components[:,PC1],components[:,PC2])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

</description>
      <category>python</category>
      <category>ipywidgets</category>
      <category>whileloop</category>
      <category>threading</category>
    </item>
    <item>
      <title>Ipywidgets not interacting in “while True” loop</title>
      <dc:creator>htraprocks</dc:creator>
      <pubDate>Fri, 29 May 2020 06:58:55 +0000</pubDate>
      <link>https://dev.to/htraprocks/ipywidgets-not-interacting-in-while-true-loop-mma</link>
      <guid>https://dev.to/htraprocks/ipywidgets-not-interacting-in-while-true-loop-mma</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;h1&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--d6fSuj3N--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackoverflow-logo-e7205b186f9c84b1d4e8eb405ef6008a5774db316bd7d257421920b0f954810f.svg" alt=""&gt;
            &lt;a href="https://stackoverflow.com/questions/61814610/ipywidgets-not-interacting-in-while-true-loop" rel="noopener noreferrer"&gt;
               Ipywidgets not interacting in "while True" loop
            &lt;/a&gt;
        &lt;/h1&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;May 15 '20&lt;/span&gt;
            &lt;span&gt;Comments: 2&lt;/span&gt;
            &lt;span&gt;Answers: 1&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/61814610/ipywidgets-not-interacting-in-while-true-loop" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xjukSftY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-up-73f60a9ccafdb2f40eec3701f62d2fd7121e02a581a2850e671a7e415eb49071.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          0
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4ZRntoBk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://practicaldev-herokuapp-com.freetls.fastly.net/assets/stackexchange-arrow-down-80fee73e4bc433405a0c0f3b9b88354ecccbdf53f131f8cd998aa30ed5223407.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;p&gt;1)This is the code snippet that I am trying to run.The main idea is that, I want the ipywidgets to be interactive, while the data is constantly being fetched from the data source. And the data is being updated at certain interval using the while loop.The objective is to plot…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    
      &lt;a href="https://stackoverflow.com/questions/61814610/ipywidgets-not-interacting-in-while-true-loop" rel="noopener noreferrer"&gt;Open Full Question&lt;/a&gt;
    
  &lt;/div&gt;
&lt;/div&gt;


</description>
    </item>
  </channel>
</rss>
