What is the purpose of meshgrid in Python / NumPy?

Can someone explain to me what is the purpose of meshgrid function in Numpy? I know it creates some kind of grid of coordinates for plotting, but I can’t really see the direct benefit of it. I am studying “Python Machine Learning” from Sebastian Raschka, and he is using it for plotting the decision borders. … Read more

Pandas read_csv low_memory and dtype options

When calling df = pd.read_csv(‘somefile.csv’) I get: /Users/josh/anaconda/envs/py27/lib/python2.7/site-packages/pandas/io/parsers.py:1130: DtypeWarning: Columns (4,5,7,16) have mixed types. Specify dtype option on import or set low_memory=False. Why is the dtype option related to low_memory, and why would making it False help with this problem? 11 Answers 11 The deprecated low_memory option The low_memory option is not properly deprecated, but … Read more

pandas create new column based on values from other columns / apply a function of multiple columns, row-wise

I want to apply my custom function (it uses an if-else ladder) to these six columns (ERI_Hispanic, ERI_AmerInd_AKNatv, ERI_Asian, ERI_Black_Afr.Amer, ERI_HI_PacIsl, ERI_White) in each row of my dataframe. I’ve tried different methods from other questions but still can’t seem to find the right answer for my problem. The critical piece of this is that if … Read more