Flask and JSON
It is possible to use the Flask framework to play with json data. The programme looks like: # import main Flask class and request object from flask import Flask, request…
A webserver from the command line
Python has a module (Flask) that allows to run a Python module from the commmand line. The code looks like: # import main Flask class and request object from flask…
Use the node.js server as restful app server
One may use the node.js server as a means to get acquainted with restful services. Let us assume this server is installed and started with json-server "C:\Users\tomva\SynologyDrive\python\json server\db.json" --port 8000…
Reading a CSV file and translate into dataframe
Below, a script is provided that reads a CSV file and translate the outcome into a dataframe: import csv import pandas as pd with open(r"C:\Users\tomva\SynologyDrive\python\pandas\Incomplete\banking.csv","r") as csv_file: csv_reader = csv.reader(csv_file,…
Plotting in pandas
Below, you see a snippet on how to create a plot in Pandas. import pandas as pd data = pd.read_csv(r"C:\Users\tomva\SynologyDrive\python\pandas\Incomplete\banking.csv", header = 0) deel = data.sample(frac =.005) ax1 = deel.plot.scatter(x='age',…
Logistic regression with Pandas
Below, you see a logistic regression with Panda import pandas as pd import numpy as np from sklearn import preprocessing import matplotlib.pyplot as plt plt.rc("font", size=14) from sklearn.linear_model import LogisticRegression…
Crosstabs in Python
Find below a Python programme that shows a crosstab whereby continuous variables are translated into classes: import pandas as pd import sqlalchemy as sa import matplotlib.pyplot as plt import numpy…
Univariate descriptive statistics in python
Below, a programme is given on the univariate statistics. import pandas as pd import sqlalchemy as sa import matplotlib.pyplot as plt import numpy as np table_name = 'MIGRATED_DIVORCE_SETTLEMENT__C' connection_string =…
Descriptive statistics in python
Below, a programme is provided that shows the point cloud with a line that is the best fit to it. import pandas as pd import sqlalchemy as sa import matplotlib.pyplot…