In [29]:
import dask.dataframe as dd
import pandas as pd
import datashader as ds
import datashader.transfer_functions as tf
import matplotlib.pyplot as plt
import numpy as np
from datashader.utils import lnglat_to_meters
from colorcet import fire
from datetime import datetime
import imageio
RETransfers = dd.read_csv("rtt_summary_all.csv", assume_missing=True,dtype={'address_low_frac': 'object',
'address_low_suffix': 'object',
'condo_name': 'object',
'discrepancy': 'object',
'document_date': 'object',
'legal_remarks': 'object',
'matched_regmap': 'object',
'receipt_date': 'object',
'receipt_num': 'object',
'reg_map_id': 'object',
'street_address': 'object',
'street_name': 'object',
'street_postdir': 'object',
'street_predir': 'object',
'street_suffix': 'object',
'unit_num': 'object'})
columns = ['objectid','display_date','lat','lng']
RETransfers = RETransfers[columns].dropna()
x, y = lnglat_to_meters(RETransfers['lat'], RETransfers['lng'])
RETransfers['x'] = x
RETransfers['y'] = y
RETransfers['display_date'] = RETransfers['display_date'].str.split(' ')
RETransfers['display_date'] = RETransfers['display_date'].str.get(0)
RETransfers['display_date'] = RETransfers['display_date'].map_partitions(pd.to_datetime,format='%Y/%m/%d',meta = ('datetime64[ns]'))
RETransfers['month'] = RETransfers['display_date'].dt.month
RETransfers['year'] = RETransfers['display_date'].dt.year
RETransfers_drop = RETransfers.drop('display_date',axis=1)