HathawayLiu commited on
Commit
a7795ca
1 Parent(s): 902abf2

Update Housing_dataset.py

Browse files
Files changed (1) hide show
  1. Housing_dataset.py +55 -69
Housing_dataset.py CHANGED
@@ -10,10 +10,6 @@
10
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
- # T0: Address all TODOs and remove all explanatory comments
14
- """ TO: Add a description here.
15
- """
16
-
17
 
18
  import csv
19
  import json
@@ -23,19 +19,15 @@ import datasets
23
  import logging
24
  import pandas as pd
25
 
26
- # TODO: Add BibTeX citation
27
- # Find for instance the citation on arxiv or on the dataset repo/website
28
  _CITATION = """
29
  @InProceedings{huggingface:dataset,
30
- title = {A great new dataset},
31
- author={huggingface, Inc.
32
  },
33
- year={2020}
34
  }
35
  """
36
 
37
- # TODO: Add description of the dataset here
38
- # You can copy an official description
39
  _DESCRIPTION = """
40
  This typical dataset contains all the building permits issued or in progress
41
  within the city of Seattle starting from 1990 to recent, and this dataset is
@@ -43,22 +35,16 @@ still updating as time flows. Information includes permit records urls,
43
  detailed address, and building costs etc.
44
  """
45
 
46
- # TODO: Add a link to an official homepage for the dataset here
47
  _HOMEPAGE = "https://data.seattle.gov/Permitting/Building-Permits/76t5-zqzr/about_data"
48
 
49
- # TODO: Add the licence for the dataset here if you can find it
50
  _LICENSE = " http://www.seattle.gov/sdci"
51
 
52
- # TODO: Add link to the official dataset URLs here
53
- # The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
54
- # This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
55
  _URL = "https://data.seattle.gov/Permitting/Building-Permits/76t5-zqzr/about_data"
56
  _URLS = {
57
  "train": "https://github.com/HathawayLiu/Housing_dataset/raw/main/housing_train_dataset.csv",
58
  "test": "https://github.com/HathawayLiu/Housing_dataset/raw/main/housing_test_dataset.csv",
59
  }
60
 
61
- # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
62
  class HousingDataset(datasets.GeneratorBasedBuilder):
63
  """This dataset contains all building permits issued or in progress within
64
  the city of Seattle. It includes the original columns in the datasets, with
@@ -74,33 +60,33 @@ class HousingDataset(datasets.GeneratorBasedBuilder):
74
  features=datasets.Features(
75
  {
76
  # columns from original dataset
77
- "permitnum": datasets.Value("string"),
78
- "permitclass": datasets.Value("string"),
79
- "permitclassmapped": datasets.Value("string"),
80
- "permittypemapped": datasets.Value("string"),
81
- "permittypedesc": datasets.Value("string"),
82
- "description": datasets.Value("string"),
83
- "housingunits": datasets.Value("int64"),
84
- "housingunitsremoved": datasets.Value("int64"),
85
- "housingunitsadded": datasets.Value("int64"),
86
- "estprojectcost": datasets.Value("float32"),
87
- "applieddate": datasets.Value("string"),
88
- "issueddate": datasets.Value("string"),
89
- "expiresdate": datasets.Value("string"),
90
- "completeddate": datasets.Value("string"),
91
- "statuscurrent": datasets.Value("string"),
92
- "relatedmup": datasets.Value("string"),
93
- "originaladdress1": datasets.Value("string"),
94
- "originalcity": datasets.Value("string"),
95
- "originalstate": datasets.Value("string"),
96
- "originalzip": datasets.Value("int64"),
97
- "contractorcompanyname": datasets.Value("string"),
98
- "link": datasets.Value("string"),
99
- "latitude": datasets.Value("float32"),
100
- "longitude": datasets.Value("float32"),
101
- "location1": datasets.Value("string"),
102
  # new added columns below
103
- "neighbordistrict": datasets.Value("string")
104
  }
105
  ),
106
  # No default supervised_keys (as we have to pass both question
@@ -135,30 +121,30 @@ class HousingDataset(datasets.GeneratorBasedBuilder):
135
  # Iterating through each row to generate examples
136
  for index, row in housing_df.iterrows():
137
  yield index, {
138
- "permitnum": row.get("PermitNum", ""),
139
- "permitclass": row.get("PermitClass", ""),
140
- "permitclassmapped": row.get("PermitClassMapped", ""),
141
- "permittypemapped": row.get("PermitTypeMapped", ""),
142
- "permittypedesc": row.get("PermitTypeDesc", ""),
143
- "description": row.get("Description", ""),
144
- "housingunits": int(row.get("HousingUnits", "")),
145
- "housingunitsremoved": int(row.get("HousingUnitsRemoved", "")),
146
- "housingunitsadded": int(row.get("HousingUnitsAdded", "")),
147
- "estprojectcost": float(row.get("EstProjectCost", "")),
148
- "applieddate": str(row.get("AppliedDate", "")),
149
- "issueddate": str(row.get("IssuedDate", "")),
150
- "expiresdate": str(row.get("ExpiresDate", "")),
151
- "completeddate": str(row.get("CompletedDate", "")),
152
- "statuscurrent": row.get("StatusCurrent", ""),
153
- "relatedmup": row.get("RelatedMup", ""),
154
- "originaladdress1": row.get("OriginalAddress1", ""),
155
- "originalcity": row.get("OriginalCity", ""),
156
- "originalstate": row.get("OriginalState", ""),
157
- "originalzip": int(row.get("OriginalZip", "")),
158
- "contractorcompanyname": row.get("ContractorCompanyName", ""),
159
- "link": row.get("Link", ""),
160
- "latitude": row["Latitude"],
161
- "longitude": row["Longitude"],
162
- "location1": str(row["Latitude"]) + ", " + str(row["Longitude"]),
163
- "neighbordistrict": row.get("NeighborDistrict", "")
164
  }
 
10
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
 
 
 
 
13
 
14
  import csv
15
  import json
 
19
  import logging
20
  import pandas as pd
21
 
 
 
22
  _CITATION = """
23
  @InProceedings{huggingface:dataset,
24
+ title = {Seattle Housing Permits Dataset},
25
+ author={Xinyan(Hathaway) Liu
26
  },
27
+ year={2024}
28
  }
29
  """
30
 
 
 
31
  _DESCRIPTION = """
32
  This typical dataset contains all the building permits issued or in progress
33
  within the city of Seattle starting from 1990 to recent, and this dataset is
 
35
  detailed address, and building costs etc.
36
  """
37
 
 
38
  _HOMEPAGE = "https://data.seattle.gov/Permitting/Building-Permits/76t5-zqzr/about_data"
39
 
 
40
  _LICENSE = " http://www.seattle.gov/sdci"
41
 
 
 
 
42
  _URL = "https://data.seattle.gov/Permitting/Building-Permits/76t5-zqzr/about_data"
43
  _URLS = {
44
  "train": "https://github.com/HathawayLiu/Housing_dataset/raw/main/housing_train_dataset.csv",
45
  "test": "https://github.com/HathawayLiu/Housing_dataset/raw/main/housing_test_dataset.csv",
46
  }
47
 
 
48
  class HousingDataset(datasets.GeneratorBasedBuilder):
49
  """This dataset contains all building permits issued or in progress within
50
  the city of Seattle. It includes the original columns in the datasets, with
 
60
  features=datasets.Features(
61
  {
62
  # columns from original dataset
63
+ "PermitNum": datasets.Value("string"),
64
+ "PermitClass": datasets.Value("string"),
65
+ "PermitClassMapped": datasets.Value("string"),
66
+ "PermitTypeMapped": datasets.Value("string"),
67
+ "PermitTypeDesc": datasets.Value("string"),
68
+ "Description": datasets.Value("string"),
69
+ "HousingUnits": datasets.Value("int64"),
70
+ "HousingUnitsRemoved": datasets.Value("int64"),
71
+ "HousingUnitsAdded": datasets.Value("int64"),
72
+ "EstProjectCost": datasets.Value("float32"),
73
+ "AppliedDate": datasets.Value("string"),
74
+ "IssuedDate": datasets.Value("string"),
75
+ "ExpiresDate": datasets.Value("string"),
76
+ "CompletedDate": datasets.Value("string"),
77
+ "StatusCurrent": datasets.Value("string"),
78
+ "RelatedMup": datasets.Value("string"),
79
+ "OriginalAddress1": datasets.Value("string"),
80
+ "OriginalCity": datasets.Value("string"),
81
+ "OriginalState": datasets.Value("string"),
82
+ "OriginalZip": datasets.Value("int64"),
83
+ "ContractorCompanyName": datasets.Value("string"),
84
+ "Link": datasets.Value("string"),
85
+ "Latitude": datasets.Value("float32"),
86
+ "Longitude": datasets.Value("float32"),
87
+ "Location1": datasets.Value("string"),
88
  # new added columns below
89
+ "NeighborDistrict": datasets.Value("string")
90
  }
91
  ),
92
  # No default supervised_keys (as we have to pass both question
 
121
  # Iterating through each row to generate examples
122
  for index, row in housing_df.iterrows():
123
  yield index, {
124
+ "PermitNum": row.get("PermitNum", ""),
125
+ "PermitClass": row.get("PermitClass", ""),
126
+ "PermitClassMapped": row.get("PermitClassMapped", ""),
127
+ "PermitTypeMapped": row.get("PermitTypeMapped", ""),
128
+ "PermitTypeDesc": row.get("PermitTypeDesc", ""),
129
+ "Description": row.get("Description", ""),
130
+ "HousingUnits": int(row.get("HousingUnits", "")),
131
+ "HousingUnitsRemoved": int(row.get("HousingUnitsRemoved", "")),
132
+ "HousingUnitsAdded": int(row.get("HousingUnitsAdded", "")),
133
+ "EstProjectCost": float(row.get("EstProjectCost", "")),
134
+ "AppliedDate": str(row.get("AppliedDate", "")),
135
+ "IssuedDate": str(row.get("IssuedDate", "")),
136
+ "ExpiresDate": str(row.get("ExpiresDate", "")),
137
+ "CompletedDate": str(row.get("CompletedDate", "")),
138
+ "StatusCurrent": row.get("StatusCurrent", ""),
139
+ "RelatedMup": row.get("RelatedMup", ""),
140
+ "OriginalAddress1": row.get("OriginalAddress1", ""),
141
+ "OriginalCity": row.get("OriginalCity", ""),
142
+ "OriginalState": row.get("OriginalState", ""),
143
+ "OriginalZip": int(row.get("OriginalZip", "")),
144
+ "ContractorCompanyName": row.get("ContractorCompanyName", ""),
145
+ "Link": row.get("Link", ""),
146
+ "Latitude": row["Latitude"],
147
+ "Longitude": row["Longitude"],
148
+ "Location1": str(row["Latitude"]) + ", " + str(row["Longitude"]),
149
+ "NeighborDistrict": row.get("NeighborDistrict", "")
150
  }