Saturday, December 30, 2017

How to Multiplots on Same Canvas using Matplotlib

Subplot function can be used to plot multiple graphs in same canvas.

Case 1:- Create graph in same ROW


import matplotlib.pyplot as plt
import numpy as np
 
%matplotlib inline
    
x = np.linspace(0, 5, 11)
y = x ** 2
 
#Instantiate figure and axes object. 
#fig, ax = plt.subplots()
 
# bydefualt on not passing any parameters in constructor, Just a figure and one subplot
f, ax = plt.subplots(nrows=1, ncols=2)
ax[0].plot(x, y)
ax[0].set_title('Simple plot')

ax[1].plot(y, x)
ax[1].set_title('Simple plot')


Case 2:- Create graph in same Column



import matplotlib.pyplot as plt
import numpy as np
 
%matplotlib inline
    
x = np.linspace(0, 5, 11)
y = x ** 2
 
#Instantiate figure and axes object. 
#fig, ax = plt.subplots()
 
# bydefualt on not passing any parameters in constructor, Just a figure and one subplot
f, ax = plt.subplots(nrows=2, ncols=1)
ax[0].plot(x, y)
ax[0].set_title('Simple1 plot')

ax[1].plot(y, x)
ax[1].set_title('Simple2 plot')


Matplotlib/subplot/python Syntax and Analysis “fig, ax = plt.subplots()”


The Matplotlib subplot() function can be called to plot two or more plots in one figure. Matplotlib supports all kind of subplots including 2×1 vertical, 2×1 horizontal or a 2×2 grid.


# Import required library
import matplotlib.pyplot as plt
import numpy as np

#First create some toy data:
x = np.linspace(0, 5, 11)
y = x ** 2

#Instantiate figure and axes object. 
# bydefualt on not passing any parameters in constructor, Just a figure and one subplot
fig, ax = plt.subplots()
#Set Data
ax.plot(x, y)
#Set Title for the graph
ax.set_title('Simple plot')


Analysis of used code

#Instantiate figure and axes object. 
fig, ax = plt.subplots()

Important feature of the below code is we are using 2 variables for assignment on instantiation of object.

Reasoning

plt.subplots() is a function that returns a tuple containing a figure and axes object(s). Thus when using fig, ax = plt.subplots() you unpack this tuple into the variables fig and ax.Thus this can also be read as 2 below statement combined as one.

fig = plt.figure()
ax = fig.add_subplot(111)



f : matplotlib.figure.Figure object

ax : Axes object or array of Axes objects.

ax can be either a single  matplotlib.axes.Axes object or an array of Axes objects if more than one subplot was created. The dimensions of the resulting array can be controlled with the squeeze keyword, see above.

Thursday, December 28, 2017

List of Keywords in Python

Keywords are the reserved words in Python. We cannot use a keyword as variable name, function name or any other identifier.

Here's a list of all keywords in Python Programming

Keywords in Python programming language

Python : Built-in Functions

Method Description
Python abs() returns absolute value of a number
Python all() returns true when all elements in iterable is true
Python any() Checks if any Element of an Iterable is True
Python ascii() Returns String Containing Printable Representation
Python bin() converts integer to binary string
Python bool() Coverts a Value to Boolean
Python bytearray() returns array of given byte size
Python bytes() returns immutable bytes object
Python callable() Checks if the Object is Callable
Python chr() Returns a Character (a string) from an Integer
Python classmethod() returns class method for given function
Python compile() Returns a Python code object
Python complex() Creates a Complex Number
Python delattr() Deletes Attribute From the Object
Python dict() Creates a Dictionary
Python dir() Tries to Return Attributes of Object
Python divmod() Returns a Tuple of Quotient and Remainder
Python enumerate() Returns an Enumerate Object
Python eval() Runs Python Code Within Program
Python exec() Executes Dynamically Created Program
Python filter() constructs iterator from elements which are true
Python float() returns floating point number from number, string
Python format() returns formatted representation of a value
Python frozenset() returns immutable frozenset object
Python getattr() returns value of named attribute of an object
Python globals() returns dictionary of current global symbol table
Python hasattr() returns whether object has named attribute
Python hash() returns hash value of an object
Python help() Invokes the built-in Help System
Python hex() Converts to Integer to Hexadecimal
Python id() Returns Identify of an Object
Python input() reads and returns a line of string
Python int() returns integer from a number or string
Python isinstance() Checks if a Object is an Instance of Class
Python issubclass() Checks if a Object is Subclass of a Class
Python iter() returns iterator for an object
Python len() Returns Length of an Object
Python list() Function creates list in Python
Python locals() returns dictionary of current local symbol table
Python map() Applies Function and Returns a List
Python max() returns largest element
Python memoryview() returns memory view of an argument
Python min() returns smallest element
Python next() Retrieves Next Element from Iterator
Python object() Creates a Featureless Object
Python oct() converts integer to octal
Python open() Returns a File object
Python ord() returns Unicode code point for Unicode character
Python pow() returns x to the power of y
Python print() Prints the Given Object
Python property() returns a property attribute
Python range() return sequence of integers between start and stop
Python repr() returns printable representation of an object
Python reversed() returns reversed iterator of a sequence
Python round() rounds a floating point number to ndigits places.
Python set() returns a Python set
Python setattr() sets value of an attribute of object
Python slice() creates a slice object specified by range()
Python sorted() returns sorted list from a given iterable
Python staticmethod() creates static method from a function
Python str() returns informal representation of an object
Python sum() Add items of an Iterable
Python super() Allow you to Refer Parent Class by super
Python tuple() Function Creates a Tuple
Python type() Returns Type of an Object
Python vars() Returns __dict__ attribute of a class
Python zip() Returns an Iterator of Tuples
Python __import__() Advanced Function Called by import

Friday, May 16, 2014

Released Magento 1.9 Wait for Magento 1.9.1


2 Days back Magento released  has Community Edition 1.9. This is a major release after 1.8.1. Same as every other major release, Magento 1.9 has also under gone major changes. Following are highlights of this release are

Magento 1.9 Screenshot with demo data
  • Less Time and Less Cost to Get a Responsive Site
  • Cross Border Price Consistency
  • Improved Payment and Financing Options
  • Fresher Search Results for Customers and Faster Indexing for Merchants
  • Cross Border Price Consistency
  • Improved Quality and More Features
http://www.magentocommerce.com/knowledge-base/entry/ce19-later-release-notes


Wait for Magento 1.9.1

Historically Magento 1.x.0 version has always been vulnerable. And to plug-in the issues, magneto has always released 1.x.1 release in next 60 days. Historically 1.x.1 version has been one there most stable releases. Going by track record, I suggest users to avoid using magento 1.9 for production as upgrade or as a fresh installation. And its more interesting to observe that magento has release Magento CE 1.9.0.1 Version within 2 days of release of 1.9 version. 
After major release wait for bugs to be fixed. 


Saturday, April 12, 2014

Review : washingmachineclinic.com Bangalore

This is  2 months pending work. This Review is about Washing Machine Clinic, Bangalore (washingmachineclinic.com). 


I had a pathetic experience from washingmachineclinic.com. Previous to actual experience I was told about their prompt and efficient service. So I decided to call them.

Got attended after number of follow up


I called them in one evening for the appointment. And I got appointment for next day. But unfortunately nobody turned up. But after a number of follow up it got attended next day.

Very High and Random charges


The person came  to my place and examined the washing machine. Immediately after examination, the person told me motor is damaged and needs to be changed. He quoted Rs 4,200.  I was confused, that the company is supposed to service all kind of washing machine and they deal with several part. How come the person knows exact price of the part? How come he told me price without consulting any paper or person. 

Going by logic that the price of machine is Rs 10,000. So how can only part be of Rs 4,200 I opted NOT to go for the service.

Next day I called Godrej service center. And I got my machine repaired in only Rs 2,400. Rs 1,800 less from what Washing Machine clinic quoted.


Always eager to change parts

In another experience of my friends, they called for the appointment.  They explained the problem. Surprisingly, at the same moment,  on same call,  they suggested one of part to get replaced. My friend was very surprised to hear that. The person is suggesting diagnosis without even examining. Later on he got it repaired WITHOUT any replacement of the said part from some other mechanic.

NOT RECOMMENDED 

After my and my friend experience I would highly recommend NOT to go for the service. Instead, I would recommend to opt for either Company customer service or any near by mechanic. 

Thursday, April 3, 2014

Amethi : After 10 years, MP don't have House, Bank Account?

Hilarious, 2 time MP don't have a house in his constituency. After 10 years he don't have even a Bank account. Having house is a basic expectation from any MP. 

Moreover, for getting the residence proofs, occasional staying in the constituency is required.  And Surprisingly, his application was rejected with one the reason as, Rahul Gandhi don't even stay occasionally?


Amethi is my home : Rahul

I have many election speeches from Rahul Gandhi. One common sentence that I can hear in every speech since 2004 is "I am in-between my family. I in my home." The words has been consistent for last 10 years. But after this revelation, I am confused what does he really mean when saying those words. 

Is this emotional Drama?

I agree that we Indian's have been traditionally emotional. Historically we have taken more decisions based on emotions then on logic. It becomes very easy for any one to touch our emotional string. And historically people from Amethi too had a emotional connection with gandhi-nehru family. And Rahul Gandhi is using same for his elections. 

After 60 years, do you need more time to develop?


Amethi has been with Gandhi-Nehu Family for neary 60 years since Independence. In other words one family was having rule for 60 years. Even if one would have planned a long term(20 years)  plan for Amethi, he would have made it a Developed city. But sad part is Rahul Gandhi is still asking vote for issue on Poverty, Health and other basic amenities.  It is interesting to conclude  from the above instance that even after 60 years Amethi is fighting for basic amenities. Things could have been different if he would have stayed more.

And same conclusion applies for India as well. 


Windows 8.1 Update brings back Start Menu


Its official now, after a lots of roar by windows users for "Start Menu" , 8.1 brings back Start Menu. When Microsoft removed the Start menu, quite a few of its users were upset, and this move did indeed make Windows 8.1 harder to use for many. With re-addition Start menu  also got updates. Now Start Menu carries traditional UI combined with live tiles and other Metro-influenced UI elements.



There are some other notable features in Windows 8.1 Update. Here is a list:

  • For traditional users, like Windows 7, 8.1 is bootable in desktop mode unlike tiles view in previous version.
  • For traditional users, Right click on a tile of an application in Modern UI mode will open a context menu.
  • For traditional users, 8.1 re-powers Task bars.
  • Allows minimize re-accessible Windows apps like facebook, chat apps from Task bars  
  • Search and shutdown buttons are now always visible in the top right corner of the screen.


Video release by Windows on April 2, 2014



Monday, March 31, 2014

PM is not silent, spoke 1117 times in 10 years

On 28th March, in a Hilarious facts presented by Media manager of Prime minister of  India, he spoke 1117 times in 10 years of in 3,650 days.According to him PM spoke every third day.  He also went on counted the occasions on which he has spoken.



According to him, PM spoke on dinners,in functions,  in Rajyasabha, in Loksabha, in front on  media, in election rallies and many many other times. Panjak Pachori also gave the reason why PM dont believed in speaking too much. He explained PM belief as "Empty vessel makes noise".

When the UPA II government faced heat during the coalscam, the Prime Minister was quoted as saying in the Rajya Sabha, "Hazaron jawabo se achchi hai khamoshi meri, na jaane kitne sawalo ki aabru rakhe. (My silence is better than a thousand answers, it keeps intact the honour of innumerable questions). "



So going by the statement, if PM speaks in a dinner, then next time he will speak will be only third day, even if he is required to make statement in Parliament. Because he speaks only once in three days. This is does not ends here, even he tweeted. Kam Bola Kaam Bola.
The PM's Media manager's statement was not that hilarious but tweet from PM was certainly more hilarious.

I hope India will get a speaking Prime-minister this time.

After 8 years, Bhullar escapes, Thanks to BJP/CONGRESS alliance

Today, March 31, Supreme Court commuted his death sentence to Life Imprisonment on the grounds of inordinate delay in deciding his mercy petition. As an implication a renowned terrorist escaped from the the deserved destiny.


Bhullar's death verdict was not one of the straight justice. After bombing in front of Youth Congress in 1993 flied to Germany. And after hard fought extradition case Germany, he was brought to India in 1995. In year 2002, 3 member Bench rejected the review petition for Death penalty.

Votes caused deliberate delays

Political parties have always managed to polarize people on emotional grounds to get votes.   In this case also parties mobilized people's emotions for the convicted person. People from the same village were brain washed giving roots as a reason. And for others people used religion as one the emotional grounds. Historically political parties has always stayed away from taking risk in such situation. 

In short, in India convicts escapes By the Parties,For the Parties Of The the Parties.. 

Affect of the verdict

This verdict is important not because 1 convict has escaped, but this verdict is important because this is going to affect other cases as well. 

 Who is responsible?

Reason for the commutation of death penalty to Life imprisonment is delay in deciding his mercy petition but not because people appealed for clemency. 

The most unfortunate fact of this whole episode is there is no Accountability. Neither BJP nor Congress can be asked for accountability for the escape? They are not answerable for to victims who have lost their dear ones. 

The delay dilutes India stand against terrorist activities in any form. Its high time that people should get answers for the delays. Its high time people should be held for the same. 

Friday, March 21, 2014

AAP asks for Rs1,100: Media finding rotten Rats?

Since the beginning of AAP, they always claimed that they will not be doing any conventional politics.It has been more than 18 month since its inception. During its inception they promised to redefine the RULES OF THE GAME. Still people has not been able to understand that when they say that it will be totally new ball game, what it really means?

Before Delhi election, they were questioned how can you fight election without formal big organization? How can you fight election with such limited resources? How can fight election with limited MONEY? But AAP not only fought election without all those luxury but also performed well.

Moving away from the conventional parties I found AAP to be only party to STOP taking donation because their requirement got fulfilled. I have never seen any conventional party to stop to taking  donations, that too during election . And so on. 

After Delhi election, I thought Media will be more educated but unfortunately still  interpreting statements in same appropriate manner. In any form of life Interpretation of words is very important. Correct Interpretation gives correct sense behind the words and selfish or interpretation with some western interest give a whole WRONG meaning to the words. And its responsibility of NEWS MEDIA to do this duty in a free and fair manner.   

Few days back, AAP Volunteers, put up a notice. If any one willing to go to AK's Varanasi rally, they require to pay Rs 1,100 for the package. Now Media is interpreting in all their way.  

It was not AAP which didn't took this initiative themselves but it was load of request from all parts of Delhi which forced them to do so. Because of public demand, for public convinces they agreed to organize the travel just like any other family travel where people give contribution to a single person and the person organizes Travel, Lodging and Fooding on behalf of all other travelers.

While Rs 1,100 was for whole package but media crying it to be a foul. Unfortunately its not their mistake. Till now it has been a practice that people will be taken to Rally place on the expense of Party. Till now conventional parties has even gone one step forward and given Liquor and Daily Allowance to the people. But as promise during Inception, again they redefined the rules. Again they brought transparency to the whole process. 

And Media is trying to find rotten Rat in a clean process.




Thursday, March 20, 2014

Realty check: Do Modi really mean by INDIA FIRST?


When Modi gave slogan of "India First", I was really impressed. I thought atlast someone came who is fighting for United India. Who really wants to work for poor.

He is PM candidate.His every slogan is bound to go under scrutiny. For him  benchmark will be very high.

He is claiming its Modi wave. And BJP will Sweep from every part of the country. Well if that happen it will be really good. Because it will be a popular government. It will be a stable government.

But do he and his party really mean by INDIA FIRST? Do he and his party really mean by Indians first?

If yes then why is he fighting from 2 place? Assuming because of Modi wave, he will win both seats. Then who will bear CRORES of election expenditure?



Delhi is a fiscal surplus state. They have less expenditure then earning. So when Arvind Kejriwal gave subsidy tailor made for poor peoples, same BJP said subsidy is bad for economy. Indian Economy can not survive of Subsidy.

When Subsidy is not good for fiscal surplus state then how can be  forceful election expenditure  be justified on capital deficit UP?

Its high time when India looks for a leader who really looks for India over personal ambition. Who is more sensitive about expenditure. Who is bold enough to say, Being PM candidate, I can win from any seat else no need to fight election and come via Rajya Sabha.

Why Expenditures are good but subsidy for poor is not good  ?

"Tum khelo to football hum khelen to Gulli-Danda"- Kumar Viswas. Now its time for equal ground for play.

Is Modi coward or BETRAYER? Fighting from 2 seats?

2014 Election. Few days, Modi announced to contest general election from Varanasi,UP. Today, He announced to fight from another seat, from Vadodara, Gujrat.

Logic given: When announced from Varanasi 

1) Modi is a real leaders of Hindus. Varanasi is one of the most important  pilgrim in Hindu mythology.  Varanasi's representation by MODI in Parliament was projected as true representation/tribute by a Pro Hindu party. 

2) UP has been historically important place for PMs. Historically UP has produced most of the PMs. 

3) Its a MODI WAVE, he can fight and win from any seat

Logic given:  When announced from Vadodara 

1) Gujarat people has made Modi today what he is. Its a true tribute to GUJRATIS



Every time with every announcement a good logic has been given by his party. Every time they sounded logical. But if we analyse  the logic given and correlate them only one question arises.

Is Modi COWARD or BETRAYER?

1) If really wanted to fight election from 2 places why didn't he announce together?
       a) Is Announcement from Vadodara is AFTER EFFECT  of Arvind Kejriwal announcement to fight from Varanasi? IS MODI COWARD? IS MODI feeling the heat of AAM ADAMI?

2) If Modi wins only ONE seat, then what about modi wave?


3) If MODI wins both seat, which seat will he LEAVE? 
       a) If leaves Vadodara, will it be appropriate to leave those people who have made Modi today what he is?        
      b) If leave Varanasi, will it be appropriate to say Modi a leader of Pro Hindu party? 
        
In any of the case Modi is going to betray one section of INDIA. IS MODI BETAYER? 

Sunday, March 16, 2014

Rally Scam Expose : Congress/BJP allows ONLY their feed to news channel.

2014 General elections are different in many ways. Conventional  Political parties have started using technology. The way they have embraced the technology looks heartening because these are same parties, which will form government. Openness to technology indicates progress in their mindset and working culture.

To involve technology and sighting logistical limitation, parties proposed to produce video themselves for the News broadcasters.  This sounded win win situation.This enabled parties to control the quality of video feed(and the content). News channels do not need any logistic.



Until now every thing sounds great and logical. But there is one more story behind the scene. Good quality is one side of coin. But the other side coin is to create fake crowd in rally. Different camera angles allows to create illusion. With advanced technique 10,000 people can be canvased as 1 Lakh people. When lots of tricks are available with Adobe Photoshop for stills, then why not its possible with moving picture.


Controlling the feed also allow to show only favorable portion of the rally.If you want to woo  Minority group the show only that portion of the crowd.

Being self producer, they tend not to show EMPTY spaces present in rally. Sometimes there are good number of empty patches, but at the name of better feed parties tend to hide the reality and claim illusive numbers of attendance.

DO NEWS CHANNEL INVOLVE ?
To shed out their responsibility NEWS Channels have started marking source as  "Source: BJP feed". Apart from recent Mamta's Delhi rally(hardly 500 people were present) I have never seen channels reporting empty spaces in Rally.I have not seen any channel  reporting/questioning the level of participation of a particular community.

By all means I feel media should continue enjoy its freedom but I feel better regulation or checks/balances are very much current time's demand. India deserves non-tampered and unbiased news. A change is awaited.

Why is Modi buying crowd for his Rally?

Its heartening to see that now Modi is giving money to bring people. Is his model not working? Why is he so keen to bring attract Minority people to his rally? 





1) This video establishes the fact about paid crowd exist.
2) The video establishes that fake Muslims are being brought in rally.
3) Money power is being used to the full to influence the 2014 election.

Why Samajwadi Party NOT fielding candidates against Sonia, Rahul Gandhi?

The SP has announced its nominees for 78 of the 80 Parliamentary constituences in UP and not named anyone so far to contest from Rae Bareli and Amethi — the two Lok Sabha seats from where the Congress President and Vice President respectively are seeking re-election.


 “We have earlier not fielded candidates in Rae Bareli and Amethi. They have shown courtesy by not fielding candidate in Kannauj (against wife Dimple Yadav). Till now, netaji (Mulayam Singh Yadav) has not given candidates in Rae Bareli and Amethi,” Akhilesh, who is also the state president of SP, told reporters in a question if they will not field any candidates from the two constituency .


Its heartening to see the legacy of understanding between the two parties. Even though SP Chief Mulayam singh is blaming  blaming the Congress for all ills plaguing the nation. But they protest Gandhi parivar's election, the spearhead of congress. Vise versa for Congress. Rahul Gandhi is also doing same for congress in UP campaigns.

This clearly shows political double standard of the two parties even though they will make other party responsible for the bad condition of UP but still they will not oppose election of their so called their opposition's chief. This becomes more interesting when SP has won all but one Assembly seats in Rae Bareli. In Amethi too the SP has won four out of five seats in recent Assembly election. 

This is a great example of feet worship. This is a great example of team work where both understands each other without any conversation. Nor We will oppose your party supremo neither you will.

The two oppositions are not opposition exactly but the 2 sides of same coin. This practice is not good for democratic structure when voter is giving vote keeping one party over other keeping their  arguments(which are sour against each-other) and finds his vote actually goes to same collations. 

Still not sure what could be the best solution but I feel some thing is required to BREAK whole CARTELIZATION. This is more dangerous than corporate ones.