Pandas Combine date and time columns

Having an issue making one datetime column. My df has a 'date' column with the date as a tuple, and a timestamp column. As shown below: df.head(2) date time 0 (2016,5,7) 01:01:01.125 1 (2016,5,8) 02:03:05.691 Is there a quick wa...
more »

2017-05-20 00:05 (1) Answers

TypeError: unhashable type: 'slice'

I am trying to run a regression using the following dataframe dfMyRoll the head of the dataframe looks like: SCORE SCORE_LAG date 2007-10-29 -0.031551 NaN 2007-10-30 0.000100 -0.031551 2007-10-31 ...
more »

2017-05-19 23:05 (1) Answers

How to lock down pandas dataframe structure

Simply put, what are the preferred practices for writing larger python applications that use pandas dataframes as its primary method for data representation? I often find myself struggling to maintain inconsistencies in dataframes, sometimes invaria...
more »

2017-05-19 15:05 (0) Answers

ANOVA for groups within a dataframe using scipy

I have a dataframe as follows. I need to do ANOVA on this between three conditions. The dataframe looks like: data0 = pd.DataFrame({'Names': ['CTA15', 'CTA15', 'AC007', 'AC007', 'AC007','AC007'], 'value': [22, 22, 2, 2, 2,5], 'condition':[...
more »

2017-05-19 10:05 (1) Answers

Python and Matplotlib: characters as the x axis

Hi Stack Overflow community. I think I am trying to code the impossible with matplotlib, so if there is a different python library that will better suit me, please let me know! I have an entire amino acid sequence (Represented as capital letters in ...
more »

2017-05-19 04:05 (2) Answers

Python Pandas Plotting Two BARH side by side

I am trying to make a plot that is similar like this, The left hand side chart (the plot with legend) is derived from df_2, and the right hand side chart is derived from df_1. However, I cannot make the two plots side-by-side share the y-axis. He...
more »

2017-05-18 15:05 (1) Answers

replacing keys for values in dataframe

I have 2 dictionaries dict1={'Water': 'H2O',  'Lithium': 'L'} dict2={'five': 'pentagon', 'eight': 'Octagon'} And the following dataframe Water five Lithium eight Chemical tests test1     ...
more »

2017-05-18 10:05 (1) Answers

multiply two python arrays using a 'lookup'

import numpy as np import pandas as pd columns = ['id', 'A', 'B', 'C'] index = np.arange(3) df = pd.DataFrame(np.random.randn(3,4), columns=columns, index=index) weights = {'A': 0.10, 'B': 1.00, 'C': 1.50} I need to multiple the values in each '...
more »

2017-05-18 06:05 (4) Answers

Tidying a messy dataset

I'm attempting to put the following dataset in tidy format using pandas. I believe my variables are Group, Temperature, Flow, Pressure and Year but I am having trouble using pandas methods to restructure it properly. Group Property 2012 201...
more »

2017-05-17 22:05 (2) Answers