<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Python on Saleem Ansari</title>
    <link>/tags/python/</link>
    <description>Recent content in Python on Saleem Ansari</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <copyright>(c) 2024 Saleem Ansari</copyright>
    <lastBuildDate>Mon, 27 Aug 2018 00:00:27 +0530</lastBuildDate>
    <atom:link href="/tags/python/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Pandas Pivot Example</title>
      <link>/2018/08/27/pandas-pivot-example/</link>
      <pubDate>Mon, 27 Aug 2018 00:00:27 +0530</pubDate>
      <guid>/2018/08/27/pandas-pivot-example/</guid>
      <description>Pandas Pivot Example</description>
    </item>
    <item>
      <title>Top 20 Stack Overflow Tags</title>
      <link>/2016/05/09/top-20-stack-overflow-tags/</link>
      <pubDate>Mon, 09 May 2016 16:00:27 +0530</pubDate>
      <guid>/2016/05/09/top-20-stack-overflow-tags/</guid>
      <description>Finding Top 20 Tags on StackOverflow main site&#xA;Download StackOverflow Tags data from following site:&#xA;https://archive.org/download/stackexchange wget -c &amp;#34;https://archive.org/download/stackexchange/stackoverflow.com-Tags.7z&amp;#34; 7za e stackoverflow.com-Tags.7z Now convert the file Tags.xml into a dataframe in Python:&#xA;import json import pandas as pd import numpy as np import xmltodict import matplotlib.pyplot as plt f = open(&amp;#34;Tags.xml&amp;#34;) all_data = f.read() o = xmltodict.parse(all_data) df = pd.DataFrame.from_dict(o[&amp;#39;tags&amp;#39;][&amp;#39;row&amp;#39;]) df[[&amp;#39;counts&amp;#39;]] = df[[&amp;#39;@Count&amp;#39;]].astype(int) df2 = df.sort_values(by=[&amp;#39;counts&amp;#39;], ascending=False).head(20)[[&amp;#39;counts&amp;#39;, &amp;#39;@TagName&amp;#39;]] &amp;#34;&amp;#34;&amp;#34; counts @TagName 1067078 javascript 1025688 java 918586 c# 885422 php 800779 android 712360 jquery 542985 python 511091 html 431790 c++ 414394 ios 380535 mysql 372444 css 319001 sql 282582 asp.</description>
    </item>
    <item>
      <title>Do Nothing objects in Python</title>
      <link>/2011/04/11/do-nothing-objects-in-python/</link>
      <pubDate>Mon, 11 Apr 2011 00:00:00 +0000</pubDate>
      <guid>/2011/04/11/do-nothing-objects-in-python/</guid>
      <description>Here is how I created a simple Do Nothing object in python.&#xA;class DoNothing(): def __getattr__(self, name): def k(*a, **b): pass return k log = DoNothing() log.debug(&amp;#34;asdfa&amp;#34;, &amp;#39;asdf&amp;#34;&amp;#39;) Now I can still have log.debug() statements throughout the code-base, in case I want them to do nothing.&#xA;All I would do is re-assign log to a DoNothing object.&#xA;log = DoNothing() I am sure there are some flaws with which approach, however this all I need for now.</description>
    </item>
    <item>
      <title>PyLucene on Fedora 14</title>
      <link>/2011/02/25/pylucene-on-fedora-14/</link>
      <pubDate>Fri, 25 Feb 2011 00:00:00 +0000</pubDate>
      <guid>/2011/02/25/pylucene-on-fedora-14/</guid>
      <description>I couldn&amp;rsquo;t install pylucene simply by following command:&#xA;yum install pylucene Nor did following work:&#xA;easy_install pylucene Nor the following :-(&#xA;pip-python install pylucene So. I had to build it myself. Here, I list those steps:&#xA;Install JCC&#xA;$ JCC_JDK=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 pip-python install jcc Download pylucene pylucene&#xA;wget -c http://apache.mirrors.pair.com//lucene/pylucene/pylucene-2.4.1-1-src.tar.gz tar zxf pylucene-2.4.1-1-src.tar.gz cd pylucene-2.4.1-1 Build and install http://lucene.apache.org/pylucene/documentation/install.html&#xA;pushd jcc # edit setup.py to match your environment JCC_JDK=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64 python setup.py build` sudo python setup.</description>
    </item>
    <item>
      <title>C&#43;&#43; reference not to be confused with Java/Python/... reference</title>
      <link>/2010/05/24/c-reference-not-to-be-confused-with-java/python/...-reference/</link>
      <pubDate>Mon, 24 May 2010 00:00:00 +0000</pubDate>
      <guid>/2010/05/24/c-reference-not-to-be-confused-with-java/python/...-reference/</guid>
      <description>This program assigns a new object of class A to reference a. It looks as expected, reference changes to new object ( see line 23,24,25):&#xA;#include &amp;lt;iostream&amp;gt; using namespace std; class A { string name; public: A(string n): name(n) { } A(): name(&amp;#34;NO ONE&amp;#34;) { } void print() { cout &amp;lt;&amp;lt; &amp;#34;I am &amp;#34;&amp;lt;&amp;lt; name &amp;lt;&amp;lt; &amp;#34;!&amp;#34;&amp;lt;&amp;lt; endl; } }; int main(int argc, char *argv[]) { A matrix = A(&amp;#34;the matrix&amp;#34;); A &amp;amp;amp;a = matrix; a.</description>
    </item>
  </channel>
</rss>
