This function concatenate longest k number of arrays to a single string.
def longest_kconsec(strarr, k):
sort = sorted(set(strarr),key = lambda x:len(x), reverse = True)[:k]
l = ['r','d','wdfe','ff','gfg','wfdew','d','ff']
The chart explains the gender difference in school performance based on different states of india. Full project report
This a tutorial is to make a filled bar chart with color-fill mapped to data. The chart was created for this project.
Continue reading “Creating a filled barchart with matplotlib”
Often we want to know how a function is written in an imported package. This post explains how to examine the source code of a function/class.
To know where the package is installed:
For the package pandas:
To examine the source code of a given function or class, import the package inspect.
import inspect as insp
print insp.getsourcefile(pandas.DataFrame) # prints the path to source file
print insp.getsourcelines(pandas.DataFrame) # prints the source code
inspect package can be found here.
Viewing the source code from IPython Notebook
? to the function name inside the ipython-notebook cell to view code description and
?? for the entire source code.
pandas.DataFrame? # shows the docstring
pandas.DataFrame?? # shows the source code and docstring