Python: reduce precision pandas timestamp dataframe

You could convert the underlying datetime64[ns] values to datetime64[s] values using astype: In [11]: df[‘Time’] = df[‘Time’].astype(‘datetime64[s]’) In [12]: df Out[12]: Record_ID Time 0 94704 2014-03-10 07:19:19 1 94705 2014-03-10 07:21:44 2 94706 2014-03-10 07:21:45 3 94707 2014-03-10 07:21:54 4 94708 2014-03-10 07:21:55 Note that since Pandas Series and DataFrames store all datetime values as … Read more

Python – How to convert JSON File to Dataframe

Creating dataframe from dictionary object. import pandas as pd data = [{‘name’: ‘vikash’, ‘age’: 27}, {‘name’: ‘Satyam’, ‘age’: 14}] df = pd.DataFrame.from_dict(data, orient=”columns”) df Out[4]: age name 0 27 vikash 1 14 Satyam If you have nested columns then you first need to normalize the data: data = [ { ‘name’: { ‘first’: ‘vikash’, ‘last’: … Read more

Creating a new column in Panda by using lambda function on two existing columns

You can use function map and select by function np.where more info print df # a b #0 aaa rrrr #1 bb k #2 ccc e #condition if condition is True then len column a else column b df[‘c’] = np.where(df[‘a’].map(len) > df[‘b’].map(len), df[‘a’].map(len), df[‘b’].map(len)) print df # a b c #0 aaa rrrr 4 … Read more

404 Not Found

Not Found

The requested URL was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.