Posts

Showing posts from September, 2019

Python, excel, pandas, write an excel file to a panda's database

Image
Using Python, Pandas and Excel to create my database I started writing a new set of python class's for the machine learning experiment. With the original code I found that I was coding all the decisions that were being made.  Now while it functioned fine, the point of getting the machine to do the work was lost. So the new one started trying to figure out how to make it quicker, reusable, and the data modifiable. The decision tree needed something to work with besides the hard coded solution.  This is where pandas and excel will come in. Below the bad descisions section is the new code.  Feel free to scroll down if that's what your here for. Image: Pandas in action. Compacted terminal print of the columns of data labeled: size, seed_type, [...], ornaments, colors, names.   The rows are identified by number only.  1 - 8.  These identifiers in the column will help the new decision tree eliminate what plant we are describing down to a list of names that fits for size, s

statistics python standard deviations

I showed my statistics teacher my python file for making stem and leaf plots, and asked her if I could use the python programs I write on my stat's tests.   I was worried she'd say no, but if she didn't want me to use them, I could manage, and I would still be making them anyways, because this helps me learn.  This is a file with three different methods/functions in it that can find your Standard Deviation of a Sample, and Standard Deviation of a Population and the z-score of a value. # Scroll to the bottom if you just want the code# Explanation:  The math is not easy to explain, but basically, you want to know: Deviation is the normal difference between the numbers in the data set and the center value - mean of all those numbers. Mean vs Median:  mean is the center value of all those integers like average   median is the center data point. (which may not be a value that is close to the average/mean.   Sample vs Population: If we wanted to know the average

statistics writing data to excel file python

Another experiment inspired by Statistics class. Excel has the tools to do this, but I'd like to find a way to do it with python and command prompt / terminal. I don't explain much in this one, but I plan to elaborate and make it do more.  But for now, I got to nappy nap before work.  For those who have seen the prior 'write to excel' experiments and followed along, this shouldn't need too much explaining. Here's the text for method info, which should display if a user types 'help' or '??' when a conflict occurs in data input: format: |__column1___ |__column2__|__column3__| .... | row1 data   | row1 data | row1 data | .... | row2 data   | row2 data | row2 data | .... | ....        | .....     | ......    | ....\n This project will ask for information to write to your excel file. The data it will ask for ( in order ): file_name:  the program will add the file extension for you. number of columns in table (max 20) name of columns o

reverse the python linked list

Image
In any experiment, if I'm not clear on what to do, I will probably google for a solution, see what I can find and work from there.  This one has a lot of solutions. The one I found that had the visual I need was the one below, but note, it uses recursion.  I use a while loop in this experiment. Here's a link that even has a python linked list reversal: https://www.geeksforgeeks.org/reverse-a-linked-list/ Lets build it piece by piece. First the node, and a test on the node. The Pytest for original single linked list I made for LearnMorePythonTheHardWay: https://camelcasenoodles.blogspot.com/2017/12/pytest-for-my-single-linked-list-in.html So our list will need: * push (add item to list) * get(retrieve item by index) * dump/graphical (see what the list looks like) * reverse(reverse the items in the list back to front) We'll do small bits at a time. First the node. and a small test. --- start code block --- class SLLNode(object): # data is data