1

I have a pandas dataframe containing time series data for imaged neurons, with columns for the area, + mean/min/max values of 4 imaged cells, over 2400 rows for each observations. There are two additional columns in the dataframe- Time(seconds) at which each observation occurred, and a column specifying the experimental condition (basal, +some drug, etc):

   Area1  Mean1  Min1  Max1  Area2 Mean2    ...     epoch Time(s)
0     28  253.536    31   854  22  109.045  ...     basal   0
1     28  181.643    16   677  22   73.591  ...     basal   0.2
2     28  163.036    16   589  22   66.727  ...     basal   0.4

and so on for 2400 rows

When trying to use the seaborn lineplot function to plot a line graph of mean time series, averaged over all cells (i.e. the average across the 'mean_' columns for each row, plotted against the time column, I get an error:

ValueError: could not broadcast input array from shape (2400) into shape (4)* message.

My code is:

ax = sns.lineplot(x='Time(s)', y=neurons_df.filter(like='Mean'), hue="condition",data=neurons_df)

I have implemented near identical code successfully before, the only difference being I was previously plotting one Y time series at a time, whereas now I am trying to plot several simultaneously.

Any ideas where I'm going wrong?

OsDavy
  • 33
  • 1
  • 4
  • Your entire first paragraph would be better illustrated with few rows of sample data and help set up a [MCVE]. See also: [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples). – Parfait Nov 01 '18 at 16:21

0 Answers0