コード例 #1
0
        new_obs.append(zl.get_bedrooms(card_info))

        # Bathrooms
        new_obs.append(zl.get_bathrooms(card_info))

        # Days on the Market/Zillow
        new_obs.append(zl.get_days_on_market(soup))

        # Sale Type (House for Sale, New Construction, Foreclosure, etc.)
        new_obs.append(zl.get_sale_type(soup))

        # URL for each house listing
        new_obs.append(zl.get_url(soup))

        # Append new_obs to list output_data.
        output_data.append(new_obs)

# Close the webdriver connection.
zl.close_connection(driver)

# Write data to data frame, then to CSV file.
file_name = "%s_%s.csv" % (str(
    time.strftime("%Y-%m-%d")), str(time.strftime("%H%M%S")))
columns = [
    "address", "city", "state", "zip", "price", "sqft", "bedrooms",
    "bathrooms", "days_on_zillow", "sale_type", "url"
]
pd.DataFrame(output_data, columns=columns).to_csv(file_name,
                                                  index=False,
                                                  encoding="UTF-8")
コード例 #2
0
ファイル: zillow_runfile.py プロジェクト: ChrisMuir/Zillow
        
        # Bedrooms
        new_obs.append(parser.get_bedrooms())
        
        # Bathrooms
        new_obs.append(parser.get_bathrooms())
        
        # Days on the Market/Zillow
        new_obs.append(parser.get_days_on_market())
        
        # Sale Type (House for Sale, New Construction, Foreclosure, etc.)
        new_obs.append(parser.get_sale_type())
        
        # URL for each house listing
        new_obs.append(parser.get_url())
        
        # Append new_obs to list output_data.
        output_data.append(new_obs)

# Close the webdriver connection.
zl.close_connection(driver)

# Write data to data frame, then to CSV file.
file_name = "%s_%s.csv" % (str(time.strftime("%Y-%m-%d")), 
                           str(time.strftime("%H%M%S")))
columns = ["address", "city", "state", "zip", "price", "sqft", "bedrooms", 
           "bathrooms", "days_on_zillow", "sale_type", "url"]
pd.DataFrame(output_data, columns = columns).drop_duplicates().to_csv(
    file_name, index = False, encoding = "UTF-8"
)