Median income problem

USA_Housing[“median_income”].hist()

KeyError Traceback (most recent call last)
~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2645 try:
-> 2646 return self._engine.get_loc(key)
2647 except KeyError:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘median_income’

During handling of the above exception, another exception occurred:

KeyError Traceback (most recent call last)
in
----> 1 USA_Housing[“median_income”].hist()

~\anaconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key)
2798 if self.columns.nlevels > 1:
2799 return self._getitem_multilevel(key)
-> 2800 indexer = self.columns.get_loc(key)
2801 if is_integer(indexer):
2802 indexer = [indexer]

~\anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
2646 return self._engine.get_loc(key)
2647 except KeyError:
-> 2648 return self._engine.get_loc(self._maybe_cast_indexer(key))
2649 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2650 if indexer.ndim > 1 or indexer.size > 1:

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: ‘median_income’

How can i fix it?

Please reply.

Please check if you have the ‘median_housing’ column in your data.

Data maeans what i have downloaded before??

Please tell me that.

How can i know which column should i take instead of median housing??

Please tell me that.

please reply.

Hi, @NIRAV_RAJ

You are importing the Dataset into your workspace right you may have kept name as “USA_Housing”. that is Dataframe here.

You need to decide which key feature you have to select and use it to plot the Histogram.
or which measures of central tendency like mean, median, mode is best suited for such data , generally median is a good as it is resistant to outliers in this case.

Here the error you are getting is due to undefined ‘median_income’ in your USA_Housing Dataframe.

Kindly check if such column does exits in your Dataframe “USA_Housing”? , on which you are performing.

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.hist.html

All the best!

This is the data of USA_Housing

Avg. Area Income Avg. Area House Age Avg. Area Number of Rooms Avg. Area Number of Bedrooms Area Population Price Address
79545.45857 5.682861322 7.009188143 4.09 23086.8005 1059033.558 “208 Michael Ferry Apt. 674
Laurabury, NE 37010-5101”
79248.64245 6.002899808 6.730821019 3.09 40173.07217 1505890.915 “188 Johnson Views Suite 079
Lake Kathleen, CA 48958”
61287.06718 5.86588984 8.51272743 5.13 36882.1594 1058987.988 “9127 Elizabeth Stravenue
Danieltown, WI 06482-3489”
63345.24005 7.188236095 5.586728665 3.26 34310.24283 1260616.807 “USS Barnett
FPO AP 44820”
59982.19723 5.040554523 7.839387785 4.23 26354.10947 630943.4893 “USNS Raymond
FPO AE 09386”
80175.75416 4.988407758 6.104512439 4.04 26748.42842 1068138.074 “06039 Jennifer Islands Apt. 443
Tracyport, KS 16077”
64698.46343 6.025335907 8.147759585 3.41 60828.24909 1502055.817 “4759 Daniel Shoals Suite 442
Nguyenburgh, CO 20247”
78394.33928 6.989779748 6.620477995 2.42 36516.35897 1573936.564 “972 Joyce Viaduct
Lake William, TN 17778-6483”
59927.66081 5.36212557 6.393120981 2.3 29387.396 798869.5328 “USS Gilbert
FPO AA 20957”
81885.92718 4.42367179 8.167688003 6.1 40149.96575 1545154.813 “Unit 9446 Box 0958
DPO AE 97025”
80527.47208 8.093512681 5.0427468 4.1 47224.35984 1707045.722 “6368 John Motorway Suite 700
Janetbury, NM 26854”
50593.6955 4.496512793 7.467627404 4.49 34343.99189 663732.3969 “911 Castillo Park Apt. 717
Davisborough, PW 78603”
39033.80924 7.671755373 7.250029317 3.1 39220.36147 1042814.098 “209 Natasha Stream Suite 961
Huffmanland, NE 52457”
73163.66344 6.919534825 5.993187901 2.27 32326.12314 1291331.518 “829 Welch Track Apt. 992
North John, AR 26532-5136”
69391.38018 5.344776177 8.406417715 4.37 35521.29403 1402818.21 “PSC 5330, Box 4420
APO AP 08302”
73091.86675 5.443156467 8.517512711 4.01 23929.52405 1306674.66 “2278 Shannon View
North Carriemouth, NM 84617”
79706.96306 5.067889591 8.219771123 3.12 39717.81358 1556786.6 “064 Hayley Unions
Nicholsborough, HI 44161-1887”
61929.07702 4.788550242 5.097009554 4.3 24595.9015 528485.2467 “5498 Rachel Locks
New Gregoryshire, PW 54755”
63508.1943 5.94716514 7.187773835 5.12 35719.65305 1019425.937 “Unit 7424 Box 2786
DPO AE 71255”
62085.2764 5.739410844 7.091808104 5.49 44922.1067 1030591.429 “19696 Benjamin Cape
Stephentown, ME 36952-4733”
86294.99909 6.62745694 8.011897853 4.07 47560.77534 2146925.34 “030 Larry Park Suite 665
Thomashaven, HI 87941-5197”
60835.08998 5.551221592 6.517175038 2.1 45574.74166 929247.5995 “USNS Brown
FPO AP 85833”
64490.65027 4.21032287 5.478087731 4.31 40358.96011 718887.2315 “95198 Ortiz Key
Port Sara, TN 24541-2855”
60697.35154 6.170484091 7.150536572 6.34 28140.96709 743999.8192 “9003 Jay Plains Suite 838
Lake Elizabeth, IN 90622-0804”
59748.85549 5.339339881 7.748681606 4.23 27809.98654 895737.1334 “24282 Paul Valley
West Perry, MI 03169-5806”
56974.47654 8.287562194 7.312879971 4.33 40694.86951 1453974.506 “61938 Brady Falls
Lewisfort, DE 61227”
82173.62608 4.018524685 6.992698757 2.03 38853.91807 1125692.507 “3599 Ramirez Springs
Jacksonhaven, AZ 72798”
64626.88098 5.44335959 6.988753539 4 27784.74228 975429.4928 “073 Christopher Falls Suite 882
West Cynthia, MA 89075-2814”
90499.05745 6.384358921 4.242191302 3.04 33970.16499 1240763.766 “6531 Chase Prairie Apt. 245
Susanshire, MN 22365”
59323.7921 6.97782794 8.273697078 4.07 37520.65773 1577017.76 “17124 Johnson Squares
Lake Robertfurt, AL 61811-3832”
77811.52203 5.314460215 6.686686133 3.24 33754.7378 1246830.188 “1359 Mitchell Vista
Courtneyfort, NY 93065-7224”
68652.60921 6.1243421 6.290820167 4.42 39355.62573 1170720.894 “4343 Joshua Lake Suite 096
Pierceview, NV 62614-9110”
55041.35158 7.127128553 8.591923294 5.36 30122.47348 1071279.21 “0057 Jacob Coves Apt. 932
Lake Emily, VA 39465-6041”
50218.70846 6.118808131 7.333554072 6.29 16810.78331 534305.1323 “039 Jordan Pike
Emilyville, ID 27442”
55909.3223 5.419562911 9.289854372 6 22355.23541 936368.9634 “66338 Novak Curve Suite 628
Taylorborough, OK 87142-6766”
74372.81021 5.500128573 6.593045604 2.07 39395.15118 1199193.831 “7167 Angela Park Suite 013
Morrishaven, NH 66937-4811”
78667.9046 5.470652207 7.780836693 4.1 27637.65655 1233220.009 “34964 Sara Fields Apt. 584
Port Raymondville, MO 63585”
78699.5151 5.652783637 6.756453856 3.01 22836.60757 1081150.125 “7585 Lynn Loop
East Judy, WV 73336”
53128.18545 5.180664125 5.426902859 2.39 32947.71196 524712.7661 “Unit 1388 Box 9350
DPO AP 70848”
17796.63119 4.949557006 6.713905445 2.5 47162.18364 302355.836 “9932 Eric Circles
Lake Martha, WY 34611-6127”
58566.84936 6.579691453 5.034525352 2.17 39705.46496 1026817.4 “7896 Walker Spring
Loriport, MH 72956”
75537.79451 7.845215914 7.555660721 6.3 32778.19534 1762214.68 “549 Darren Plaza
Lake Kevin, UT 27155”
46147.05306 6.623332829 7.60683155 4.43 27161.12861 882057.1706 “90634 Michelle Valleys
North Victoria, WV 99370”
70421.47649 6.90708297 7.634318731 4.44 43183.92849 1744932.211 “580 Lara Neck Apt. 541
Davidsonstad, ID 34638-9802”
62614.42062 5.499309697 7.440505218 6.32 26888.57956 1153871.47 “43087 Jerome Field
West Deborah, SD 49213”
66394.87159 7.069512154 7.204639709 3.18 39741.07751 1499988.88 “71956 Jenkins Fall
Brooketown, PW 67485-0764”
73946.85107 4.863154306 7.537182365 6.35 35261.12702 1109588.38 “8034 Pierce Prairie Suite 727
Devonfurt, NE 33104-8027”
69144.74571 7.296224497 5.928223473 3.22 19030.61549 980177.3051 “Unit 8108 Box 5159
DPO AP 04678”
77278.69703 6.238891015 6.919204136 2.13 21725.95429 1323952.027 “08639 Garcia Port
Anthonybury, CT 17971”
86754.19663 6.604439819 6.252454805 4.02 43017.44076 1662494.736 “91863 Curtis Point
New Richard, AK 99996-7554”
74399.84098 6.382452912 7.252665322 6.36 41084.66282 1417819.74 “03819 Lee Junction Suite 046
Mooneyborough, WA 19656”
49408.19834 5.825920476 5.831738973 3.32 26881.1306 549976.1456 “7796 Joseph Burg
Danielsside, RI 70370”
62279.79005 6.108449991 6.30611635 4.12 35263.65314 1054770.981 “173 Mendoza Land
West John, NJ 57690”
73078.20409 5.92390639 6.445456691 3.32 54915.96178 1415647.553 “3288 Lee Pass
South Julieton, PW 02759-4964”
72942.70506 4.786222295 7.31988553 6.41 24377.90905 948788.2757 “86908 Marshall Port Suite 252
Scotttown, NM 69143”
63819.62285 5.949839471 8.022469239 4.09 27825.57206 1159596.519 “951 Bryant Dale Suite 735
Lake Jacqueline, NH 95266”
73265.44989 8.314761979 7.42559746 3.24 21030.96618 1547133.396 “00301 Bradshaw Avenue Suite 833
Suzannefurt, IN 00654-8754”
68488.13117 6.116111748 7.18252748 5.08 18267.95471 1186688.506 “84473 Ochoa Pines Apt. 808
Jamesport, KY 70207-2955”
55193.85745 7.186120667 5.096917456 4.01 32537.81877 772111.9721 “13706 Morgan Turnpike Suite 378
Hohaven, NC 42699”
77434.68924 6.309271353 5.219754029 3.06 36252.34068 1172730.156 “4872 Delgado Ramp
North James, IA 36544”
66158.88159 4.476429066 6.91174261 2.28 37098.74217 1111085.017 “73202 Christopher Tunnel
New Roberttown, MN 08925-1536”
60502.90933 7.533380986 5.731824125 4.23 33579.63151 1022781.171 “8781 Olivia Port Apt. 225
Thompsonside, VT 22884”
60910.89379 5.635466738 7.325973781 4.2 43347.804 1274474.546 “PSC 9354, Box 0703
APO AA 58696-1278”
73931.97852 6.394107667 4.580839921 4.32 36543.06728 1213530.85 “271 Johnson Hills Apt. 001
Mcculloughfurt, FM 70847”
59539.94845 6.018590243 7.007676166 5.43 58600.82715 1411730.477 “122 Russo Neck
South Kevin, KY 20712-5282”
56547.50719 5.435415183 6.515149877 3.13 37585.27458 858685.5659 “85225 Christopher Inlet Apt. 627
West Calebberg, KS 76460”
65950.34702 5.476513158 6.717844306 3.28 40110.8476 1200961.821 “7125 Mullins Cliff
Maryborough, WY 66971”
74533.16208 6.67935313 5.919230725 4 49481.56581 1520234.229 “905 Lane Pines Suite 348
Brownborough, DE 57196-3319”
66422.91905 7.12207185 7.078583745 6.36 31019.32482 1360908.32 “61090 Griffith Ridges
Craigstad, AK 28807-8602”
74334.49485 5.419012564 6.261535284 4.12 41640.43566 1360920.53 “270 Jennifer Loop Suite 343
South Jesse, ND 60570-1483”
63538.34616 4.764499308 7.168662411 3.27 43282.183 1146532.455 “10973 Clark Trafficway
Meyersbury, LA 63237”
83953.10484 7.385134534 6.898846569 3.08 37283.35765 1789098.521 “91733 Baker Orchard
South Kyle, KS 37301”
57279.06358 5.118108905 6.561520216 3.17 44023.79068 852099.464 “024 William Course
East Charlotteview, DE 69073-3104”
56553.55025 5.691129213 7.021252354 3.15 29682.40986 746096.7289 “PSC 4455, Box 3268
APO AP 45454”
75795.57598 5.786780024 7.327325343 6.25 33197.77774 1534479.907 “562 Brown Junction Suite 282
Christopherborough, KS 20719”
70848.78866 5.28232502 6.766444664 3.27 40458.73587 1215608.531 “USCGC Thompson
FPO AA 13237-3887”
59787.4045 5.653120316 6.594592279 3.43 32402.10755 941594.3284 “65884 Johns Valley Apt. 621
Ethanbury, NY 07783”
64826.37189 4.010907337 8.290419813 4.38 60286.0431 1204598.037 “Unit 2139 Box 3667
DPO AP 49517”
65925.8538 7.605511954 7.070409541 3.28 34171.36007 1597655.258 “253 Golden Island
East Donald, CT 91882”
64419.25264 6.954422126 8.516160048 6.16 39318.17075 1492011.496 “4861 Steven Plains Suite 066
Port Reginaland, MN 06152-7205”
58544.4603 8.562610576 7.276308629 4.28 30865.58695 1421216.504 “5255 Rebecca Junctions Suite 240
Royshire, WI 85782-2398”
68791.79169 4.725552228 6.704201604 4.11 48423.32244 1132522.901 “2833 Townsend Cliffs
New Tommy, MP 86130-3426”
82061.5652 4.182828228 5.963031884 4.1 36271.4085 1102821.438 “708 Pena Ramp
Terryburgh, CA 31572-1304”
80659.52544 5.436306202 7.100753432 6.24 52947.03636 1856211.35 “8030 Ruiz Dale
Shermanchester, KY 56950-5684”
66668.09352 6.184965339 7.863127437 3.35 47075.21223 1687998.933 “Unit 3857 Box 9497
DPO AE 92239”
64721.5645 5.677637527 6.971331701 4.48 36115.81636 1063423.007 “042 Mitchell Mountains
Adamsview, OR 44424”
65199.98994 6.445742898 6.937127028 3.2 28366.03543 1177289.886 “07420 Victoria Trail Apt. 904
Port Kevinbury, OR 86759”
74579.98953 4.639654131 5.521489299 3.07 42806.14664 1173474.379 “38449 Shaw Glen
Pattonside, TX 98415”
76273.67033 7.879751801 4.500165348 3.39 46974.57879 1637259.999 “82387 Hensley Bypass
Danielmouth, ME 30791”
67561.94206 5.251400747 7.658576339 4.04 35517.54187 1238938.291 “02304 Brandon Stravenue Apt. 231
Cordovabury, ID 36688”
48904.98327 4.844972531 5.44895603 3.38 32960.75307 201898.0866 “2124 Garcia Viaduct
North Kellytown, DC 30864”
72145.96721 6.39862599 8.258634923 6.06 28882.90085 1439506.102 “646 Nicholas Mall Apt. 058
East Danielle, OR 53708”
70805.61068 4.443728924 5.809147306 3.3 29268.82674 585608.6326 “874 Laura Throughway Suite 350
Port Michaelberg, PW 94284-9448”
65383.33792 7.512526779 6.640032004 3.46 35114.40246 1294685.159 “7373 Hart Brooks Apt. 168
East Christianside, PR 72679-9159”
95450.29309 6.595060685 6.850361008 3.33 39388.51552 2014851.344 “035 Mark Bridge
West Craig, MT 78649”
73698.69636 6.372730932 6.578352074 4.33 51815.09642 1840236.006 “69600 Wilson Rue
Elizabethland, PW 17767-2884”
66263.9105 6.374930066 6.736974131 4.41 49829.9515 1441421.913 “001 Steve Plaza
Jessicastad, UT 25190”
75394.75958 6.933352468 7.834099801 4.48 22268.07531 1498640.551 “238 Anthony Drive
Acostahaven, AS 62753-6637”
65984.75064 6.512270085 6.31648002 2.38 21867.47694 954746.5764 “01818 Wilson Spurs
West Andreaton, SD 69568-7005”
66477.26279 6.982151725 6.038487979 2.37 32458.9867 1124635.932 “95779 Walton Square
Bakershire, PR 49599”
69284.25964 5.347447091 7.173425885 3.45 40282.72428 1169944.248 “124 Russell Mountains Apt. 591
North Sharonfurt, OH 67836-4969”
70404.4961 5.544083726 6.001261362 2.02 37127.9255 1114430.953 “73080 Veronica Turnpike Suite 991
New Debra, VA 61246”
74218.48902 8.069721867 6.506374302 4.37 46770.66097 1783534.839 “106 Williams Well Apt. 657
Samanthaview, PR 87811”
63441.71465 6.471673727 7.064811136 3.22 48061.75267 1302933.248 “Unit 3405 Box 4348
DPO AP 68816-2990”
57493.92457 6.893260157 6.734045416 4.41 47039.21532 1241483.612 “4007 Kimberly Crossing
Nathanielview, NC 72093-8287”
81543.77732 5.503923196 5.897052836 2.14 9816.300885 954114.544 “Unit 5889 Box 7282
DPO AE 41177-0399”
78633.97376 5.465393231 7.531143012 3.24 43728.80349 1555320.5 “075 Andrea Green Suite 201
Johnshire, KS 50389”
52202.85372 4.869306181 4.414380866 2.23 42165.81246 404976.3659 “6811 Spears Trail Suite 081
East Troy, MS 43910”
67980.38878 5.562938814 6.159705222 2.44 25909.0792 1073183.76 “69401 Danielle Motorway
New Dennis, IL 53971”
78568.44916 5.47573732 6.291600796 2.29 41016.64709 1422195.879 “2276 Riley Flats Suite 975
Johnmouth, NH 39983”
55472.65483 4.822147136 5.855972309 3.2 15353.95643 340605.2113 “91111 Crane Spur
Kathleenmouth, ME 43022-3191”
67579.23479 5.973219004 7.754357545 6.32 21762.94969 1170959.526 “744 Hill Ports
Mooreside, MH 20945-2825”
61456.1507 6.882954326 6.417572622 4.19 30821.41209 942838.1647 “019 Lisa Village Apt. 379
Maxwellmouth, DE 26176”
60815.39039 7.17012853 7.984335122 4.11 31233.64935 1401613.92 “50933 Barber Divide Suite 927
Jacksonborough, NE 46696-1788”
51217.18116 5.384841407 8.776160034 3.41 47089.47508 1175504.486 “USS Harrington
FPO AE 12326”
63027.67471 4.855968121 5.580905937 2.3 35991.72064 608794.2467 “246 Michele Lock Suite 093
South Michellemouth, VI 62800”
62484.8553 6.496651466 7.322709774 5.13 26882.65179 946943.0362 “356 Madeline Locks Apt. 115
Kaitlinland, MS 49150-0243”
73923.46627 7.005505785 7.135063347 6.04 58745.31203 1819900.637 “232 Allen Ridge
West Jasonview, CT 93021”
79737.60976 7.315957927 6.611096005 2.17 28307.31433 1463130.273 “5042 Ricky Road
New Candice, MN 40661-8809”
63890.47157 4.972306568 7.916386397 5.49 43416.49782 1252391.18 “60860 Griffin Streets Apt. 040
East Catherine, NH 18346”
67310.03695 7.193792989 7.760732555 5.28 43310.61243 1714445.175 “89002 Robert Square Suite 028
Port Jennyside, CA 38546-6307”
73145.73022 4.096517243 7.254217433 3.18 49463.37888 1291759.393 “8533 Sparks Lodge
New Kevin, GA 98179”
86924.35877 6.832939699 7.738295553 6.32 28719.41089 1809154.289 “922 Mark Lodge
Matthewton, ID 71131-3139”
74384.10563 7.411486571 5.164865476 2.3 17117.44367 1200539.361 “757 Sherri Shores Suite 744
Jesusfurt, OK 73052-4985”
67477.78818 6.623528293 7.91617166 5.1 29763.92535 1300265.21 “PSC 8479, Box 0952
APO AA 33741”
71202.95692 4.318869133 6.634954066 4.37 34207.39721 997448.7281 “5560 Michaela Spur Suite 730
West Charlottefurt, PA 00463”
85845.3178 6.743652961 9.468766369 3.46 46477.67868 2152959.409 “255 Sosa Pines Suite 751
Wilsonview, MT 31615”
72138.87048 7.163640935 8.485778263 5.45 35799.63827 1629983.847 “156 Conner Lane
East Brittany, MI 26733”
44806.00516 4.494570528 4.725325117 3.1 57390.89007 497579.4466 “478 Vasquez Fort Apt. 346
Aliciaside, NV 37124-6408”
67504.17846 5.329798509 5.894411949 4.36 37441.12054 890112.5493 “67610 Smith Knolls
Brendaberg, MA 55188-7972”
74706.10053 5.003327764 5.661064127 2.05 39680.60932 1064685.699 “504 Robertson Streets
Jamesshire, WA 56754”
68898.34591 6.787648529 7.871352644 6.39 39515.57156 1530124.016 “777 Ross Crossroad
Kaiserville, RI 24445”
58118.01816 8.137214471 5.650900286 4.36 35598.39044 1246246.828 “2418 Samantha Green Apt. 016
Port Keithmouth, VT 62207-0408”
77643.28309 6.070115922 5.381038359 4.45 35512.25505 1240754.932 “95957 Tara Hill Suite 428
Huntland, KS 57002-5552”
67769.82559 8.074693668 6.761631408 4.22 33254.60341 1760734.69 “26906 Simmons Underpass Suite 444
Port Tinashire, DC 13101”
74411.05989 5.534627544 7.210123361 6.44 43537.50295 1393746.76 “4930 James Flats
New Shannon, NJ 75829-8040”
73101.0788 4.104129923 8.920333221 4.35 29497.97129 1172385.898 “78212 Turner Ville Apt. 217
West Lauraberg, MP 47353-3682”
58708.41716 5.083861036 6.262825884 4.07 15969.92604 483986.109 “33410 Smith Summit
West Kimberlyberg, CT 49785-3758”
63876.05991 7.080219326 7.187432975 3.37 38052.87644 1388530.157 “49940 Ramirez Mission Suite 136
West Bryan, MD 95291-3904”
68343.15409 6.39244379 8.425112895 6.2 40653.87007 1721739.384 “4746 Morgan Forge
Diaztown, VT 79978”
73064.97996 5.994062799 7.204368895 6.19 30699.33971 1276448.792 “5808 Burton Viaduct
North Nicholasport, CO 32392-1208”
67367.26808 6.774710809 6.690894899 2.49 32547.27253 1161742.677 “8093 Lara Overpass Apt. 364
Lake Brookebury, NV 30264”
66547.18175 6.350672042 5.305000412 2.04 16741.96499 786407.9451 “249 Susan Canyon
North Jessica, ID 13412”
73313.54538 6.414723236 8.492901229 4.46 37808.99667 1604920.973 “08091 Bush Course
New Michael, RI 47524-7511”
47681.36173 6.890508224 7.788267986 5.13 50908.97891 1230149.137 “PSC 6933, Box 3805
APO AP 50576”
67910.94913 6.445851907 6.675937268 4.32 31379.78297 1051644.554 “6798 Smith Junctions
Wolfeton, WY 86565-5079”
69277.89125 6.142591681 7.811724471 5.15 43717.91309 1415073.614 “256 Sanchez Ports Apt. 057
Johnmouth, PA 69763”
67946.71468 5.403175673 5.671136343 3.21 35197.94257 1043483.915 “68672 Guzman Ridge
Clinefurt, WI 04078-6179”
90975.11327 4.740683035 8.320351986 6.45 44426.21365 1544379.748 “4447 Steven River Suite 076
West Karenmouth, DC 61561-8593”
61885.54644 5.405265969 6.91419577 3.22 48726.9513 1352135.967 “USCGC Hess
FPO AE 29193”
69401.84722 7.042354995 8.097044285 3.44 29293.07405 1505727.431 “0617 Neal Curve
South Daniel, AS 09326”
72969.12127 6.188575726 8.076943604 4.2 31755.72136 1416965.979 “412 Janet Radial Suite 115
Kariview, NY 37073-8343”
75582.45976 5.506473429 6.774986419 4.33 31946.30387 1046721.976 “9155 Kayla Station Suite 233
Natalieborough, SC 99093-8399”
56241.22677 5.623087016 6.818670754 2.18 32745.36812 939040.0036 “3062 Donald Inlet Suite 642
West Matthew, GU 49340”
79412.83547 6.087360169 7.481321112 3.26 17568.73376 1383031.332 “764 Timothy Turnpike
North Audreymouth, TX 02395”
79618.23685 4.566166101 6.669888411 3.49 29636.50711 1072503.238 “862 Ryan Flat
West Larryborough, WV 11517”
67019.07405 6.487943167 7.3313301 6.26 24997.10871 1134397.758 “378 Evans Crest
East Shelbystad, HI 23326”
56063.48087 5.10693512 5.385339778 4.14 39129.2967 734827.508 “09897 Katherine Forge
North Johnside, NC 01211”
57077.5803 5.775467041 6.952026674 4.27 33393.9166 991892.3175 “2367 Noah Center
North Dakotashire, PA 99619-0890”
75954.81825 4.289916281 7.418750603 5.04 34467.7587 1057252.583 “19678 Noble Cove Suite 264
South Elizabethfort, CO 13304-1647”
52575.81517 7.133719417 7.173698882 4.06 41828.57962 1237224.859 “8803 Jackson Ramp
South Thomasland, RI 09631-6361”
63312.80567 6.139115452 8.199615241 4.41 43230.35216 1442632.541 “87629 Shawn Crossing
North William, MN 71601-6188”
82526.9621 6.453073406 7.748248953 4.46 43947.68026 1877402.32 “2574 Shannon Alley
South Fred, OR 64217”
73204.94213 6.640915863 7.311912321 6.4 35090.50081 1394518.415 “676 Jose Locks Apt. 415
South Cynthia, SC 89264”
56357.19314 5.707903109 5.240300887 3.25 38061.9983 953939.3299 “4160 Martinez Bridge Apt. 713
West Ann, MI 89447-0160”
71316.62465 7.107767687 7.088992691 5.33 21651.69941 1219778.034 “26847 Weber Ports Apt. 767
North Robinton, FM 43014”
75046.8482 4.983084629 8.877240042 3 32468.03115 1287325.382 “PSC 8891, Box 6475
APO AP 28726-5123”
84474.16006 6.970854746 5.935909326 2.47 38677.81515 1739893.555 “623 Jackson Road Apt. 492
Sarahville, NM 19973”
68162.68393 6.962206716 6.69735801 3.07 31843.87634 1213382.223 “0575 Edward Cliff
Miguelmouth, NY 06408”
62784.33295 7.572350215 4.652717554 3.31 35122.38947 1007478.748 “6660 Alex Park
Barkerfort, WY 52781”
67009.81567 6.849769937 7.610720856 3.22 39737.12261 1528756.126 “176 Parker Grove Apt. 591
Nicoleshire, MO 83183-5326”
67437.25036 6.767363237 6.703917223 2.05 29356.22337 1182459.772 “203 Amy Ford Suite 158
Kelleyfurt, LA 49990-9626”
65967.76931 6.847724976 7.777279444 3.14 35799.96255 1474546.762 “842 Jackson Parkway
Angelabury, MI 68188-8699”
42816.30589 7.603999923 7.04524851 4.18 47457.66221 1078016.94 “5339 Charles Road Apt. 570
East Angelicastad, PR 36295-7649”
83347.6697 5.468158427 5.475252653 3.14 48226.71893 1453381.624 “0647 Ramirez Hill
New Crystalport, AZ 33060”
81699.88 5.47980183 6.476007341 4.41 39527.04856 1495012.965 “4233 Chase Fields
East Vanessabury, OR 85375-7861”
56143.78866 4.580122446 6.668979774 4.04 45084.03666 714148.4148 “0606 Ricardo Drive
Williamton, GU 79243”
59513.83492 4.885131771 5.57471435 3.18 44162.27921 894292.0474 “14157 Jones Parkway Suite 319
North Haley, AK 18534”
78379.41224 5.985697151 5.681833507 3.2 31357.38821 1159841.831 “2579 Pamela Shoals
North Christianhaven, TX 95259”
70877.37574 6.766877154 7.213659075 5.07 36033.42685 1195986.299 “PSC 5171, Box 6452
APO AA 44610-4655”
61526.97445 6.593962539 9.180401429 6.11 27307.94803 1381430.63 “23682 William Glens Apt. 920
Lake Hollystad, CO 20067”
65316.99602 7.414875231 6.733084867 2 55799.49748 1534889.853 “32521 Martinez Highway
Stephaniehaven, NY 78577”
76268.81833 6.942797867 6.147907596 3.17 38649.85239 1494125.33 “9109 Omar View Suite 461
East Sarahfort, WI 02969”
48531.36423 6.863184039 8.517401059 5.3 39731.15056 1356146.261 “5611 Chandler Mill
East Brianfort, AK 51236-0093”
82906.6548 5.901451656 5.767366136 4.26 38820.48194 1454943.074 “PSC 5599, Box 5942
APO AP 55563-1953”
63117.84405 4.940396705 5.636779395 2.31 43091.84514 774118.1878 “2128 Shawna Orchard Suite 992
New Melissabury, MN 22338”
75860.86115 3.69089057 4.788380207 3.48 41003.88008 889113.2389 “019 Moore Center Apt. 643
West John, KY 54923”
68844.76425 4.860453 6.916808181 3.29 48392.49736 1211102.211 “Unit 3192 Box 6415
DPO AP 76779-7624”
52446.26686 5.694610808 7.429639244 3.11 32934.5532 658646.1847 “20185 Mary Crest
South Reneeville, VI 91892”
69342.70684 5.804686752 7.805903702 3.36 37082.37422 1400104.871 “18067 Williams Roads Suite 683
South Christineton, CO 76227”
55932.05268 7.218309145 6.020201205 4 42488.31 1262017.792 “089 Wilson Forks Suite 185
East Gina, PA 98785-6132”
53306.92214 4.632267718 6.194794325 2.15 39063.33871 553077.2126 “9643 Oscar Valley
North Richardstad, ME 14629-9980”
56976.5464 6.061212241 7.259286709 3.08 46375.50249 1203247.89 “46619 Morgan Squares
Stevenfurt, FM 70548”
51296.48863 6.155259764 7.831766476 6.18 32078.9068 1115323.015 “407 Silva Inlet Apt. 301
East Carolmouth, SC 73414”
63995.00489 7.59753322 7.090050637 5.25 24748.26827 1301881.417 “USCGC Friedman
FPO AE 57606-0743”
71915.14669 6.279753854 5.521216371 4.47 27714.29366 1006687.387 “038 Anderson Club Suite 485
Richardsonfort, MA 22267”
62137.59721 5.440725043 7.235191288 5.21 19045.61951 749383.0726 “014 Shaun Gardens
Lake Todd, HI 08110”
78050.96983 5.234044768 6.290305888 4.15 27789.74852 1075596.587 “2606 Stout Inlet
Port Brenda, SC 59596-5906”
67371.42086 5.333820712 6.624951289 4.37 24797.76476 739870.7936 “94952 Hall Cliffs Suite 366
West Jessica, MT 23902”
59362.76638 7.482630242 8.003006746 3.49 44723.35373 1442945.145 “8581 Johnson Ranch Apt. 905
Jacquelinefurt, MH 08716-8228”
57003.10964 7.01058346 6.356258719 3.14 29594.69337 828497.0671 “089 Jessica Dale
West Melissa, PW 59364”
68989.31221 6.075426018 7.879588245 6.37 32629.60383 1373290.861 “USNS Hamilton
FPO AA 90003”
70969.9021 4.901817799 6.396268006 3.18 24833.64615 925566.3313 “8016 Hicks Alley Apt. 735
Nicoleside, WV 73615-4795”
82251.65301 7.741091334 7.636653827 6.49 18408.79864 1552536.764 “04952 Michael Terrace Apt. 414
Port Tammy, GA 56924-1868”
71306.4573 5.773717163 6.68823017 2.04 43284.39716 1335904.501 “3890 Hunt Trail
Davidhaven, OR 04793”
70921.56857 5.665185385 6.375371505 3.28 29390.21727 960808.2911 “8398 Sanchez Gateway Suite 937
Mccoyburgh, PA 32814”
70739.4601 6.710699576 7.166501646 6.28 35148.66775 1405933.019 “67095 Jeffrey Islands Suite 573
West Elizabeth, MI 33061-9433”
58097.84182 6.386347996 6.144038119 3.04 19903.00008 619087.6936 “31995 Moore Brook
New Melissa, MO 19787”
51273.50885 7.032317226 6.888205629 2.09 53811.89491 1329273.228 “Unit 5683 Box 5483
DPO AA 78774-2982”
76326.59232 5.02469487 4.936329009 3.44 42779.8313 1261843.844 “77194 Carlson Causeway Apt. 904
West John, KY 70976”
63584.04588 5.832827571 6.029160867 4.29 46340.18858 1175781.418 “73601 Donaldson Squares
Port John, VI 73473”
86340.28729 4.930051 6.183440077 3.01 35630.56045 1437053.557 “6864 Michelle Field Apt. 339
Madisonmouth, KY 99033”
79471.23882 5.867269778 8.197289421 6.21 36616.16883 1594415.226 “35165 Haley Falls Suite 341
South Elizabeth, VT 29143-4442”
55879.50379 6.407946258 5.370386614 2.07 37360.06356 931357.9954 “54993 James Place Suite 797
South Kenneth, CA 86457-1211”
40503.54133 6.881778623 6.566175293 3.14 45979.47754 798639.6542 “6799 Downs Plaza
Randallberg, NH 17910-5241”
83394.40783 5.601486668 5.905024344 2.08 30487.52462 1451739.625 “79098 Brandon Island Suite 624
Horneshire, MA 35281-8110”
64501.22645 6.001641691 7.293476754 5.33 43869.30998 1278991.689 “8173 Rush Wells
New Stephanie, MS 56356”
59569.53734 6.279536891 7.325379539 4.24 31294.65246 885920.5532 “762 Corey Landing Suite 528
Billymouth, AZ 48958”
69280.31627 6.861548028 6.923618932 4.33 40290.91149 1425632.542 “077 Laura Curve
New Christopherview, AZ 15138”
66342.48968 5.857266082 6.94910892 3.06 11792.81516 901881.7427 “5342 Dean Overpass
Matthewville, MI 08613”
73367.04599 6.173290661 9.054709888 5.25 23684.78795 1521730.791 “469 William Shore Suite 726
South Krystalchester, MP 47720”
57122.22484 5.70765003 5.929733805 2.4 41972.77154 716771.0057 “566 Brown Grove Apt. 886
Cardenasmouth, IN 87042-1285”
61978.84805 7.912276047 8.437966416 5.37 56957.18775 1696717.107 “017 Bowers Field
Williamsstad, OK 15934-8122”
54299.96882 6.635899749 6.851535828 2.49 39512.66371 819598.0078 “05946 Wong Spur
Susanshire, NY 67746-2473”
71424.40601 5.59893322 8.522538378 3.49 37242.56159 1584213.957 “9297 Cole Highway
Patrickhaven, DC 02945-8988”
57353.15436 8.07544792 5.678555483 4.44 16906.42172 798892.515 “88404 William Cape Apt. 249
Dawsonhaven, MA 21219-3496”
44731.1098 4.188658329 8.942797164 5.12 39633.47304 601973.0017 “4896 Jennifer River Apt. 180
Shafferberg, MN 77619-4214”
76175.49393 4.524140652 9.524973612 4.28 30760.99496 1456486.293 “82014 Stanton Gardens Suite 664
Lake Dawnborough, DC 86197-4191”
66574.70999 5.550264729 6.844150153 2.17 69575.44946 1702406.039 “551 Macdonald Viaduct
West Stephanie, TN 55360”
91731.15438 5.184810712 7.94387972 6.3 33102.09542 1566471.008 “860 Thompson Skyway Suite 901
Kimshire, AR 37353-5106”
75487.0326 6.453931678 7.737095684 4.02 41105.39063 1592210.176 “5036 Peterson Throughway
East Megan, GA 08456-4696”
58088.43813 6.017831001 5.790005274 4.21 51925.41161 937628.3467 “Unit 5584 Box 2763
DPO AE 40544”
76319.2186 6.873130198 6.294054951 3.45 48026.30837 1558547.578 “09437 Carolyn Mountain
Knappview, CA 70608-7504”
60575.16244 5.907565592 6.964616002 2.29 32158.9679 1156329.274 “5052 Chloe Lights Apt. 374
North Scott, IA 81431”
69607.13367 7.077680826 7.833081192 3.35 34609.04022 1514349.692 “8781 Robert Lakes Suite 880
East Wendy, ID 51813”
67056.84048 5.222168522 7.163517523 5.25 25134.68148 1039107.326 “3440 Cannon Lakes
Port Melaniehaven, WA 60324-0399”
60640.93188 5.165921529 5.355113624 2.32 43119.54066 809089.6719 “0956 Isabella Lodge
East Valeriefurt, CO 64441”
69031.90888 5.779976246 5.501755138 3.23 15660.40301 675536.3915 “36736 Kristi Radial
Port Carl, ID 35292-9269”
80356.20939 4.660417824 9.710216896 5.02 16215.41728 1373589.804 “10492 Reed Track
North Ericstad, IA 78774-8363”
60081.17662 6.768523696 8.204552838 4.3 60195.74627 1690091.019 “Unit 6269 Box 9041
DPO AE 13073”
61881.47931 6.519463053 7.114083652 5.38 35597.37289 1253370.149 “1486 Elizabeth Plains Apt. 235
New Cynthia, MD 73729-5878”
59590.96529 6.891731041 5.736029404 2.03 24153.88252 774073.5619 “239 Anna Locks Suite 853
Lisaland, GA 31515-2260”
89831.31929 5.20196372 7.719652764 6.37 45335.36028 1741959.834 “77610 Evan Field Apt. 712
West Shannonland, WI 30751”
72175.2835 7.421738946 6.828247305 2.09 50305.79541 1705762.788 “11385 Thomas Ford
New Karinaton, HI 01691-9923”
67589.04884 6.21484263 6.060884656 2.34 33203.38392 1071109.917 “385 Barnes Lock Suite 561
Lake Kellytown, NJ 74310”
77300.03144 5.260974726 6.936548024 4.49 29499.04095 1118047.991 “039 Chan Meadows
South Amandahaven, TN 78068”
65382.88832 5.39681918 7.648386114 6.08 41723.05474 1165253.033 “945 Schneider Villages Apt. 519
West Brittneyburgh, ID 36371-1622”
71145.2127 6.152109975 6.765832563 2.31 35642.53034 1280910.19 “15288 Steven Extensions Suite 209
Zacharybury, KS 87707-6205”
61053.038 5.787890692 5.687062576 2.02 40675.77383 841122.8824 “8559 Cooper Cove Suite 935
Katherinemouth, NE 81147-6595”
65125.94787 5.928483443 7.057757992 4.19 37642.78527 1228810.745 “90043 White Lane Apt. 673
Williamburgh, DE 67265”
51949.2957 6.209803037 8.051118256 5.28 35336.06305 1086072.071 “40094 Yates Lodge Suite 008
Fergusonborough, LA 87592-4342”
75897.98884 5.316933287 6.768229399 3.33 34162.67061 1204372.295 “17853 Michael Motorway
Danielfurt, MH 28095”
71468.3505 6.158043453 6.361238405 3.35 43269.03337 1345004.12 “48466 Brown Port Apt. 116
South Chelseatown, CO 28752”
53287.99207 5.755609227 7.162322376 3.32 45152.01427 1116902.345 “0205 Rose Crescent
East Ritaside, MD 10967”
61503.0406 5.13081313 7.015317326 3.12 37650.86971 822431.7303 “18941 Ray Ports
East Nicoleland, OR 67363”
68896.04856 6.38632518 8.365074594 4.47 28394.60978 1360623.694 “1515 Watson Fort
Christopherberg, MP 90562”
91159.41833 6.536045428 7.373850919 3.01 54861.0911 2298379.487 “170 Smith Wall
South Christopherhaven, AZ 87521”

Now tell me which should i select as median income?
PLease reply

Good Data.

Explore the zeroth column “Avg. Area Income” and find out is it the average income of all the population living on that area(then you can directly take it) or just the average income of that particular individual? the you need to find the median from all the data in that column and regularize it to a median value.

If this is the variable that you are predicting (who is having maximum income ) on the basics of other features like no. of rooms, no. of bedrooms and House average values, then it need to be considered.

All the best!

please tell me the steps so i can do it?

How can i find the median from all the data in that column and regularize it to a median value??

Tell me the programs so i can do.

Please reply.

Kindly refer the below pseudo syntax and explore for exact one.

  1. median_income_value=df[“Avg. Area Income”].median()
  2. median_income=df[“Avg. Area Income”].replace(median_income_value)

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.replace.html

All the best!

i did .

pd.DataFrame.median

pd.DataFrame.index

pd.DataFrame.columns

pd.DataFrame.dtypes

but still USA_Housing[“median income”].hist() shows error.

  1. median_income_value=df[“Avg. Area Income”].median()

File “”, line 1
median_income_value=df[“Avg. Area Income”].median()
^
SyntaxError: invalid character in identifier

It is telling me this error.

How can i fix median income ??

Please reply.

what is df here? did you define the data frame name or path variable for your dataset?
send the complete code ASAP.

File “”, line 1
median_income_value=pd.DataFrame[“Avg. Area Income”].median()

                                    ^

SyntaxError: invalid character in identifier

How can i fix it?

i did not understand.

about define the data frame name or path variable for your dataset

How can i do it ?

Please tell me that.

Where should i define it?

Please give me the full code.

Please create the dataframe from my dataset.

Please give me the full code to how to convert dataset to median income.

Please tell me all the steps like a teacher.

if you can please do it for me.

Really , i did not understand anything.

Please do this for me.

Please

Please reply.

https://www.kaggle.com/sohier/tutorial-accessing-data-with-pandas

but there is no median_income converting

So how can i do it please tell

tell me the all process until median_income converting
USA_Housing[“median_income”].hist()

please tell me that.

please reply.

Hi Nirav,

Which project are you trying to do when you are getting this error?

Also, to fix the follow error, please delete the double quotes and type the double quotes again. Looks like the double quotes are in some other character set.

Can you give me your own data because it will take more Time on another??

Please give me your own housing data.

How should I write that file??

Because I did everything and I got error every time so I left it

Please tell me the full step till converting the avg.imcome to median income.

Please reply.

I did it after seeing that this page have been uploaded by a user in csv formet over the internet but none of you told me that there is a column name median income instead of that you have to take Avg.area inacome as median income after that convert it to income_cat.

I am sorry for that but some of you do not understand the level of every student./You only think like an IITIAN.

THis is not good.

Please understand the level of each and every student so they can understand better.

You can not teach everyone on that same level because people have different thoughts proccess.

so please try to go to each students s’ level.

Hi Nirav,

We have a mixed bag of learners. Some of them are quite experienced in their domain, and then there are some who are freshers. We create our course materials keeping both of them in mind.

You posted your first query related to a US housing data, and we have been trying to help you with the same. However, you surely can work with the dataset that we have. It is available at the below link:

I checked from my end that you have enrolled for the Machine Learning Specialization course, and have already gone through the End-to-End Machine Learning lecture videos. The above dataset have been used in that video. I would suggest you to use the following command to clone our GitHub repository, which contains the dataset and all the related Jupyter notebooks, to your lab environment. Please open a web console on CloudxLab lab, and type the following command:

git clone https://github.com/cloudxlab/ml ~/ml

After this, you will have access to the dataset, you can follow the lecture videos and the Jupyter notebook to start working with this dataset. Also, if you are facing any challenges, please share a screenshot of your code and the error that you are getting. That helps us understand the issue better and provide you a solution quickly.

Hope this helps.

Rajtilak