What do you want to save?
Add Code snippet
New code examples
-
Other 2022-03-09 12:40:08
query mriqc api with Python
In [2]: def get_iqms(modality, versions=None, software='mriqc'): """ Grab all iqms for the given modality and the list of versions """ url_root = 'https://mriqc.nimh.nih.gov/api/v1/{modality}?{que... Add solution -
Python 2022-03-02 20:00:07
pandas join two series on index
# credit to Stack Overflow user in the source link s1 = pd.Series([1, 2], index=['A', 'B'], name='s1') s2 = pd.Series([3, 4], index=['A', 'B'], name='s2') pd.concat([s1, s2], axis=1) Out: s1 s2 A 1 3 B 2 4 pd.concat([s1, s2], axis=1).reset_... Add solution -
Python 2022-02-17 22:55:27
pandas merge multiple dataframes
df_3 = pd.concat([df_1, df_2]) Add solution -
Python 2022-01-30 19:42:06
explode dictionary pandas
arxivdf.reset_index(inplace=True) # didn't drop the index coz I will need it later tmp = arxivdf.explode('data') # 'data' is the column that has a list of dictionaries dict2df = tmp['data'].apply(pd.Series)[['category', 'link', 'summary', 'title']] # the ... Add solution -
Python 2022-01-27 01:45:38
dataframe from two series
In [1]: s1 = pd.Series([1, 2], index=['A', 'B'], name='s1') In [2]: s2 = pd.Series([3, 4], index=['A', 'B'], name='s2') In [3]: pd.concat([s1, s2], axis=1) Out[3]: s1 s2 A 1 3 B 2 4 In [4]: pd.concat([s1, s2], axis=1).reset_index() Out[4]: ... Add solution -
Python 2022-01-24 08:45:46
get dummies pandas
note: dummies = pd.get_dummies(df[['column_1']], drop_first=True) df = pd.concat([df.drop(['column_1'],axis=1), dummies],axis=1) note:for more that one coloum keep ading in the list dummies = pd.get_dummies(df[['column_1', 'column_2','column_3']], drop... Add solution