Python Forum
Python data prep help for confidence interval - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Python data prep help for confidence interval (/thread-8525.html)



Python data prep help for confidence interval - eslearner - Feb-24-2018

Hi
I am getting my feet wet with Python 2.7 and would request help with any code logic that can help prep data for confidence interval.

Problem : From the data set I am trying to figure out the regions with a population of at least A where the number of houses per latitude/longitude is at least c and at least % of the houses have price between a and b with (1-x) confidence.

Overview : I am passing parameters from command line where the first I read population, second households, third percentage of homes , fourth price range that fall in the percentage and finally the confidence factor. Example : python stat.py population households 70 100000 300000 0.9 Sample data set:
population households median_income median_house_value
9873 4012 5.4032 318500
10877 3958 4.6357 244900
12427 2826 2.7377 28300
12873 3931 8.0137 399200

İmage


Here is how far i got:
a) Have the code written to check the command line parameter for population and household. (housing is the data set ,transactions_pop and transactions_households are read from command line)
Code: results_population = housing[(housing.population >= transactions_pop) & (housing.households >= transactions_households)]
b) What I need help is logic/code to find out let's say 70% of the homes between 100000 300000.This data would be passed to step c below. I know I not supposed to ask logic questions but appreciate any help.
c) Have the last part of the code written to find the confidence interval. This is where we do the mean,standard dev and find confidence interval.

Appreciate help/inputs...