Stackplot ‘isfinite’ Error

I was trying to do a stackplot basically like this,

../../_images/stackplot_demo_01_00.png

Figure from: http://matplotlib.org/examples/pylab_examples/stackplot_demo.html

The code was the following,

import pandas as pd
import matplotlib.pyplot as plt
import numpy as np

f = “move_user_prop_dist.csv”
df1 = pd.read_csv(f).set_index(“dist_bin_center”)
df1 = df1.drop(df1.columns[0],axis=1).transpose()

x = np.array(df1.index)
y1 = df1[25]
y2 = df1[75]
y3 = df1[125]

fig,ax = plt.subplots()
y = np.vstack((y1,y2,y3))
ax.stackplot(x,y)
plt.show()

 

However, Error comes out:

TypeError: ufunc ‘isfinite’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ”safe”

Found no solution online so far. Suggestions welcomed.

 

 

Advertisements

SinoGrids: a practice for open urban data in China

Continue reading “SinoGrids: a practice for open urban data in China”

Featured

Urban vibrancy in association to urban physical environment: A perspective of multi-source big spatial data.

Authors: Yulun ZHOU, Yimeng SONG, Jixuan CAI & Bo HUANG

Keywords: urban vibrancy, built environment, big spatial data

wordcloud.png

Abstract: Successful urban planning and design is not only about materialized order, but also about place-making and urban vibrancy. However, there have been few quantitative empirical studies of the relationship between urban vibrancy and urban physical environment (UPE). In this study, a new quantitative measurement of urban vibrancy is developed inductively based on the intensity of social and economic activities in an area. A multi-scale classification scheme for urban vibrancy is used to identify existing vibrancy centers and their multi-scale polycentric structure. Potentially vibrant areas are also explored and mapped. The results show that UPE is one of the dominant determinants of urban vibrancy. The associations between urban vibrancy and a list of selected UPE factors are investigated, and the association is found to be non-stationary for different levels of urban vibrant areas. Generally, points of interest (POI) density, road junction density, age of buildings and average housing prices are found to be the major reflectors of urban vibrancy in Shanghai. The non-stationarity is also modeled to provide appropriate suggestions for improving the UPE at each level of urban areas. The final section of the paper clarifies the causal relationships driving the statistical correlations. This study establishes a framework for urban vibrancy studies that includes evaluation, classification, and modeling. The proposed method for evaluating urban vibrancy also serves as a reminder and demonstration of how relatively abstract social concepts can be measured with big data, as long as the method is firmly based on the combination of existing empirical theories and data relevancy.