49 KiB
49 KiB
Exercise: Have a look at the neural data using Pandas¶
In [2]:
import pandas as pd
# Set some Pandas options: maximum number of rows/columns it's going to display
pd.set_option('display.max_rows', 1000)
pd.set_option('display.max_columns', 100)
Load electrophysiology data¶
In [6]:
df = pd.read_csv('QC_passed_2024-07-04_collected.csv')
1. How many rows/columns does the data set have?¶
In [7]:
df.shape
Out[7]:
2. Display the first 5 rows of the DataFrame¶
In [8]:
df.head(5)
Out[8]:
3. Display the names and dtypes of all the columns¶
In [9]:
df.dtypes
Out[9]:
4. Display the unique values of the high K concentration
and of the treatment
columns¶
In [10]:
df['high K concentration'].unique()
Out[10]:
In [11]:
df['treatment'].unique()
Out[11]:
5. Display the main statistics of the max_spikes
column¶
In [13]:
df['max_spikes'].describe()
Out[13]:
6. Show all the rows where the max number of spikes is larger than 50¶
In [14]:
df[df['max_spikes'] > 50]
Out[14]:
7. Display the main statistics of 'max_spikes'
, for the rows where high K concentration
is 8 mM
and 15 mM
(separately)¶
Are the distributions any different?
In [17]:
df[df['high K concentration'] == '8 mM'].max_spikes.describe()
Out[17]:
In [18]:
df[df['high K concentration'] == '15 mM'].max_spikes.describe()
Out[18]:
8. Display the statistics of max_spikes
when high K concentration
is 8 mM
, and the maximum number of spikes is <= 100¶
Does that change your conclusion?
In [19]:
df[(df['high K concentration'] == '8 mM') & (df['max_spikes'] <= 100)].max_spikes.describe()
Out[19]:
9. Transform the high K concentration
column into a numerical column¶
a) Discard the last three characters of the columns (' mM'
)
b) Use .astype(float)
to convert to floating point numbers
c) Save the result in a column K (mM)
In [23]:
df['K (mM)'] = df['high K concentration'].str[0:-3].astype(float)
In [25]:
df.head()
Out[25]:
In [ ]: