Posts

Showing posts from November, 2019

Get request ip address using express in Nodejs

Image
Get request ip address using express in Nodejs Here’s the way to get the x-forward-for head var ip = req . headers [ 'x-forward-for' ] make sure all the keyword is lower case!! It took me half a day to find this mistake. Result: Reference https://stackoverflow.com/questions/8107856/how-to-determine-a-users-ip-address-in-node https://flaviocopes.com/express-headers/

Python Pandas little tips with the Lambda Function

Image
Python Pandas little tips with the Lambda Function Pandas Pandas is a useful tool for data science because we can use this tool to analyze, visualize & manipulate data stored within data sets, or in coding terms, within data frames. Python Lambda A lambda function is a small anonymous function. A lambda function can take any number of arguments, but can only have one expression. Here’s a little tips that we can using lambda to do some easy data process on dataframe: x = [ 176 , 166 , 156 , 186 ] df = pd . DataFrame ( { 'height' : x } ) df [ 'inch' ] = df [ 'height' ] . apply ( lambda x : x / 2.54 ) df Reference https://www.w3schools.com/python/python_lambda.asp