You can do some application for steemit using python
Read the details here
https://steemit.com/steemit/@naveendavisv/2-how-to-build-applications-for-steemit-with-python-programming
Showing posts with label python. Show all posts
Showing posts with label python. Show all posts
Monday, October 30, 2017
Monday, October 16, 2017
Bitcoin/crypto currency JSON format data extract using python programming
This progarm we try to extract the data on every 15min from https://coinmarketcap.com/api/ to mysql database using python program.
How to get bitcoin json data using python
1.https://coinmarketcap.com/api/
Get the api details
2. create a python program
json object format:
Bitcoinurl.py
3. create table in mysql
if you need to know more about mysql go through https://dev.mysql.com/doc/refman/5.7/en/creating-tables.html
4.crontab to schedule every 15min. You have to identify user python program location and give
Watch the video tutorial below.
How to get bitcoin json data using python
1.https://coinmarketcap.com/api/
Get the api details
2. create a python program
json object format:
Bitcoinurl.py
3. create table in mysql
if you need to know more about mysql go through https://dev.mysql.com/doc/refman/5.7/en/creating-tables.html
4.crontab to schedule every 15min. You have to identify user python program location and give
Watch the video tutorial below.
Sunday, September 17, 2017
Python + Anaconda+tensorflow in Linux
I would say that the best way to learn datascience and machine learning is through installing Anaconda in your linux system.
You can set up your tensorflow very easily .It is very easy to setup anaconda environment through command line.
You can set up your tensorflow very easily .It is very easy to setup anaconda environment through command line.
Tuesday, April 11, 2017
Malayalam article on python programming ..
I just started with translating some of the tutorials about python programming into Malayalam. it is difficult to find the Malayalam letters in Ubuntu.. Below video helped me to start with it. I tried Latex to configure with Malayalam , but
not succeeded .
Screenshot of First page:t
This page built using LibreOffice writer.
not succeeded .
Screenshot of First page:t
This page built using LibreOffice writer.
Monday, April 10, 2017
Installing texlive in My ubuntu Machine
I want to try translating some computer programming books to malayalam...
texlive -latex full packages will give you an opportunity write good looking books.
installation in Ubuntu:
apt-get install texlive-full
I don't think texlive support malayalam fonts,but let me see whether I can copy-paste from some translator.
texlive -latex full packages will give you an opportunity write good looking books.
installation in Ubuntu:
apt-get install texlive-full
I don't think texlive support malayalam fonts,but let me see whether I can copy-paste from some translator.
Wednesday, March 22, 2017
numPy Python module - Revisit
I know that there is a module called 'numPy' in python from long time before, but I did not care that one much, thinking it is just library for math functions.
If you try to learn Machine learning, then it is important to learn the numPy module as a prerequisite for ML. The calculation in Machine learning functions are build with matrix or column vector manipulations.
I remember that how difficult is it to do matrix manipulations in C programming. Usually it will come as a lab exam in college :-) ( that skill is needed),but if you are really focusing on applications or functionalities , the calculations part should be minimal and easy. Numpy module gives that freedom to focus on the applications part.
from numPy import *
matrix = array([[1,2,3],[3,4,5]])
the above single statement give you a matrix 2 columns and 3 raws. how cool it is !!!
you can get the matrix dimension with following python statement
matrix.shape
Matrix addition - looks so simple as shown below
if you check the data type for 'matrix' you will get the below -
>>> type(matrix)
"<"class numpy.ndarray="">
If you try to learn Machine learning, then it is important to learn the numPy module as a prerequisite for ML. The calculation in Machine learning functions are build with matrix or column vector manipulations.
I remember that how difficult is it to do matrix manipulations in C programming. Usually it will come as a lab exam in college :-) ( that skill is needed),but if you are really focusing on applications or functionalities , the calculations part should be minimal and easy. Numpy module gives that freedom to focus on the applications part.
from numPy import *
matrix = array([[1,2,3],[3,4,5]])
the above single statement give you a matrix 2 columns and 3 raws. how cool it is !!!
you can get the matrix dimension with following python statement
matrix.shape
Matrix addition - looks so simple as shown below
if you check the data type for 'matrix' you will get the below -
>>> type(matrix)
"<"class numpy.ndarray="">
Tuesday, March 21, 2017
5 things I find very useful and new in Python programming
1. List - (a list of values. Each one of them is numbered, starting from zero )
I find it very handy in Python programming language , because looping through list and reading each values are very easy in List.
num = [3,4,5,6]
items = ['desk','pen','pencil']
you can read through List very easily as below -
2. split function
You can split a string with any seperator and put into a list very easily with this function.
3.Map function
Map applies a function to all the items in an input_list.
Output:
{1,4,9,16]
4. Reduce Function:
Reduce is a really useful function for performing some computation on a list and returning the result.
Below example we are passing the 'sum' function to inbuild 'reduce' function and getting the total sum for the list of numbers.
Output:
14
5.Some thing you find very strange in Python ( Mutable and Immutable objects)
I thought it was bug, but its not ..
eg:
First Lets me create a list as below.
a = [1,2]
then simply create another list 'b' and assign 'a' + [3]
b= a;
b+=[3]
what you will expect on 'b' .. obviously .. [1,2,3]
But what you expect on 'a'... I thought that i didn't change anything in 'a' , so it should be same, but what actually 'print a' become [1,2,3]
read below link for more details - http://book.pythontips.com/en/latest/mutation.html
https://codehabitude.com/2013/12/24/python-objects-mutable-vs-immutable/
I find it very handy in Python programming language , because looping through list and reading each values are very easy in List.
num = [3,4,5,6]
items = ['desk','pen','pencil']
you can read through List very easily as below -
2. split function
You can split a string with any seperator and put into a list very easily with this function.
3.Map function
Map applies a function to all the items in an input_list.
Output:
{1,4,9,16]
4. Reduce Function:
Reduce is a really useful function for performing some computation on a list and returning the result.
Below example we are passing the 'sum' function to inbuild 'reduce' function and getting the total sum for the list of numbers.
Output:
14
5.Some thing you find very strange in Python ( Mutable and Immutable objects)
I thought it was bug, but its not ..
eg:
First Lets me create a list as below.
a = [1,2]
then simply create another list 'b' and assign 'a' + [3]
b= a;
b+=[3]
what you will expect on 'b' .. obviously .. [1,2,3]
But what you expect on 'a'... I thought that i didn't change anything in 'a' , so it should be same, but what actually 'print a' become [1,2,3]
read below link for more details - http://book.pythontips.com/en/latest/mutation.html
https://codehabitude.com/2013/12/24/python-objects-mutable-vs-immutable/
Is ML(Machine Learning) a Programming Style ?
I remember that I started programming with declaring variables and doing multiplication, addition , 'for/while' loops etc.. Suddenly one day my Plus1 computer teacher started writing functions, those days I didn't know that I was moving to a new programming style . Functions were looks very natural and nothing surprising to me. But when I came to know that some of programming languages only running with functions(but it took years to realize that :-)) ..check this link Functional Programming
I came to know that this can be adopted as a programming style.
When I moved to Plus 2 standard, I think that is time when I started hearing about about objects oriented programming. I felt so surprising that "Why the teacher is taking me to different different words/concepts like inheritance,polymorphism ,abtraction etc.." ok I just bi-hearted them to pass the exams. But I can remember that my teacher was trying to understand me that 'object oriented programming' is new programming style.
Now I started going through some of the ML(machine learning) tutorials, I am getting same doubt like 'Is it going to be a new programming style or Is it the future programming method ?'
I came to know that this can be adopted as a programming style.
When I moved to Plus 2 standard, I think that is time when I started hearing about about objects oriented programming. I felt so surprising that "Why the teacher is taking me to different different words/concepts like inheritance,polymorphism ,abtraction etc.." ok I just bi-hearted them to pass the exams. But I can remember that my teacher was trying to understand me that 'object oriented programming' is new programming style.
Now I started going through some of the ML(machine learning) tutorials, I am getting same doubt like 'Is it going to be a new programming style or Is it the future programming method ?'
Monday, March 20, 2017
Machine Learning with Python
Machine learning is coming as an easy programming technique in these days.I thought it requires lot of maths to do something on ML.But what I understand is that it becomes very easy with python tools. With python programming sci-kit and pandas libraries, we can makes some cool applications very easily.
But still I am in the learning process now.
These tutorials helps me a lot to keep updated with ML.
But still I am in the learning process now.
These tutorials helps me a lot to keep updated with ML.
Tuesday, February 28, 2017
why Python programming ...
Python is very effective when I want to learn a new thing like image processing, Machine learning , Networking...
You can directly jump into the functionality or subject area, I mean that your core subject area that you want to hack... there are lot libraries that support these subject areas.
Last week I was reading a book 'Learn Python Network Programming' by Dr. M.O Faruque Sarker.
It is interesting that Python simplifies the subject 'Networking Protocols and Programming ' which i just byhearted in BTECH.
I experienced the same thing when I tried to learn about ML with Python.
You can directly jump into the functionality or subject area, I mean that your core subject area that you want to hack... there are lot libraries that support these subject areas.
Last week I was reading a book 'Learn Python Network Programming' by Dr. M.O Faruque Sarker.
It is interesting that Python simplifies the subject 'Networking Protocols and Programming ' which i just byhearted in BTECH.
I experienced the same thing when I tried to learn about ML with Python.
Friday, February 3, 2017
Practice Machine learning online
I was searching for some of the tutorials for machine learning today. I came across a free online platform https://my.datascientistworkbench.com where you can do data science easily.
The platform support Python,R and scala language. In this I would say I am only familiar with Python language,but I am not aware of data science libraries in Python. So started searching some some tutorials .. I found some good youtube tutorials below https://www.youtube.com/channel/UCWN3xxRkmTPmbKwht9FuE5A/videos
Python is so strong that you can do some machine learning applications.
The platform support Python,R and scala language. In this I would say I am only familiar with Python language,but I am not aware of data science libraries in Python. So started searching some some tutorials .. I found some good youtube tutorials below https://www.youtube.com/channel/UCWN3xxRkmTPmbKwht9FuE5A/videos
Python is so strong that you can do some machine learning applications.
Thursday, June 30, 2016
debug a python program
How to debug a python program:
It is important to get know the debugging method ,if we really started to learn a new programming language:
In Python programming language we have a tool similar to gdb which is pdb.
You can start debugging as below :
python -pdb -m selectsort.py
more details on pdb - https://docs.python.org/2/library/pdb.html
http://infohost.nmt.edu/tcc/help/pubs/python22/pdb-commands.html
It is important to get know the debugging method ,if we really started to learn a new programming language:
In Python programming language we have a tool similar to gdb which is pdb.
You can start debugging as below :
python -pdb -m selectsort.py
more details on pdb - https://docs.python.org/2/library/pdb.html
http://infohost.nmt.edu/tcc/help/pubs/python22/pdb-commands.html
- s(tep)
- Execute the current line, stop at the first possible occasion (either in a function that is called or on the next line in the current function).
- n(ext)
- Continue execution until the next line in the current function is reached or it
returns. (The difference between
next
andstep
is thatstep
stops inside a called function, whilenext
executes called functions at (nearly) full speed, only stopping at the next line in the current function.) - unt(il)
- Continue execution until the line with the line number greater than the current one is reached or when returning from current frame.New in version 2.6.
- r(eturn)
- Continue execution until the current function returns.
- c(ont(inue))
- Continue execution, only stop when a breakpoint is encountered.
- j(ump) lineno
- Set the next line that will be executed. Only available in the bottom-most frame. This lets you jump back and execute code again, or jump forward to skip code that you don’t want to run.
- l(ist) [first[, last]]
- List source code for the current file. Without arguments, list 11 lines around the current line or continue the previous listing. With one argument, list 11 lines around at that line. With two arguments, list the given range; if the second argument is less than the first, it is interpreted as a count.
- a(rgs)
- Print the argument list of the current function.
- p expression
- Evaluate the expression in the current context and print its value.
Tuesday, June 14, 2016
Python linked list
If you are planning to refresh your data structure knowledge, I would recommend this website http://www.geeksforgeeks.org/data-structures/
Tree or Linked list datastructure programming heavily use the recursion concept ... recursion is something that sometimes cause me brain crash :-)
But once you understand it and learn how to use recursion , then that is where you start mastering datastructure concepts.
If you look at Tree or linked list, it is a repetition of a node or a same structure(http://quiz.geeksforgeeks.org/binary-tree-set-1-introduction/) .. so when there is repetition of something, then there is always scope for recursion concepts to apply...
Python Linked List:
Python programming language also have OOP concepts. So that means we can define a class http://www.diveintopython.net/object_oriented_framework/defining_classes.html
You can go through the linked list details in the below link
http://quiz.geeksforgeeks.org/linked-list-set-1-introduction/ . You will see two classes they defined for implementing linked list.
I was just trying to build without 2 classes. We can build a linked list, I dont know why they used 2 classes..I am not sure on how python is doing this dynamic memory allocation.
Program:
Strace:
Tree or Linked list datastructure programming heavily use the recursion concept ... recursion is something that sometimes cause me brain crash :-)
But once you understand it and learn how to use recursion , then that is where you start mastering datastructure concepts.
If you look at Tree or linked list, it is a repetition of a node or a same structure(http://quiz.geeksforgeeks.org/binary-tree-set-1-introduction/) .. so when there is repetition of something, then there is always scope for recursion concepts to apply...
Python Linked List:
Python programming language also have OOP concepts. So that means we can define a class http://www.diveintopython.net/object_oriented_framework/defining_classes.html
You can go through the linked list details in the below link
http://quiz.geeksforgeeks.org/linked-list-set-1-introduction/ . You will see two classes they defined for implementing linked list.
I was just trying to build without 2 classes. We can build a linked list, I dont know why they used 2 classes..I am not sure on how python is doing this dynamic memory allocation.
Program:
Strace:
Thursday, May 19, 2016
Django with Angular js
This is very nice document http://django-angular.readthedocs.io/en/latest/angular-model-form.html ,one django learner should practice to get confidence on his/er django web development skills. I am sure the document gives you good learning experience in web development .
What is Django ?
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source https://www.djangoproject.com/
What is Angularjs?
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly.
https://docs.angularjs.org/guide/introduction
http://www.w3schools.com/angular/
What is Django ?
Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web development, so you can focus on writing your app without needing to reinvent the wheel. It’s free and open source https://www.djangoproject.com/
What is Angularjs?
AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML's syntax to express your application's components clearly and succinctly.
https://docs.angularjs.org/guide/introduction
http://www.w3schools.com/angular/
Saturday, April 16, 2016
how to build Django admin page
It might be a time consuming and headache to build admin page for website. But the case is so cool with Django :-). I started with Django because I like python language. But its so amazing that you can build some pretty cool things in short span of time.It was a little difficult to start with it,but in my experience its pretty easy thing once you used with it.
Below is the tutorial I followed to build the admin page.
http://www.djangobook.com/en/2.0/chapter06.html
http://www.djangobook.com/en/2.0/chapter06.html
Tuesday, April 12, 2016
Models in Django to create tables
How to connect Mysql database to Django
manged to install mysql database in ubuntu and created some tables using Models in Django.
Below online book is really helpful to master Django- http://www.djangobook.com/en/2.0/chapter05.html
models.py:
Mysql:
manged to install mysql database in ubuntu and created some tables using Models in Django.
Below online book is really helpful to master Django- http://www.djangobook.com/en/2.0/chapter05.html
models.py:
Mysql:
Tuesday, April 5, 2016
sqllite3 commands in Ubuntu Shell
How to install and use Sqllite3 in Ubuntu:
Its quite easy to install sqllite3 in Ubuntu using 'apt-get install sqlite3'
naveen@naveen-Inspiron-7352:~/mysite$ sqlite3 mydb
SQLite version 3.8.2 2013-12-06 14:53:30
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /home/naveen/mysite/mydb
sqlite> exit
...> exit()
...> create table employee(id integer,name TEXT );
Error: near "exit": syntax error
sqlite> create table employee(id integer,name TEXT );
sqlite> insert into employee(1,'naveen');
Error: near "1": syntax error
sqlite> insert into employee values (1,'naveen');
sqlite> ;
sqlite> select * from employee
...> ;
1|naveen
sqlite> .exit
Its quite easy to install sqllite3 in Ubuntu using 'apt-get install sqlite3'
naveen@naveen-Inspiron-7352:~/mysite$ sqlite3 mydb
SQLite version 3.8.2 2013-12-06 14:53:30
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq name file
--- --------------- ----------------------------------------------------------
0 main /home/naveen/mysite/mydb
sqlite> exit
...> exit()
...> create table employee(id integer,name TEXT );
Error: near "exit": syntax error
sqlite> create table employee(id integer,name TEXT );
sqlite> insert into employee(1,'naveen');
Error: near "1": syntax error
sqlite> insert into employee values (1,'naveen');
sqlite> ;
sqlite> select * from employee
...> ;
1|naveen
sqlite> .exit
Django Login Page
After the struggle of 2 days :-), I succeed to create login page in Django with sqllite3. First we need to set up sqllite .. visit this site for more details http://www.saltycrane.com/blog/2007/11/django-project-2-sqlite-setup/
The other issue was , I was keep on getting the 'CSRF cookie not set'. I managed to exempt the CSRF using below technique, but its better use CSRF. http://stackoverflow.com/questions/22812721/why-do-i-get-csrf-cookie-not-set-when-post-to-django-rest-framework
and finally my login page worked !!!!!!!!!!!!
The other issue was , I was keep on getting the 'CSRF cookie not set'. I managed to exempt the CSRF using below technique, but its better use CSRF. http://stackoverflow.com/questions/22812721/why-do-i-get-csrf-cookie-not-set-when-post-to-django-rest-framework
and finally my login page worked !!!!!!!!!!!!