Skip to content

Commit

Permalink
fix column names
Browse files Browse the repository at this point in the history
  • Loading branch information
fenke committed May 27, 2024
1 parent 514b9c9 commit ef26052
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions nbs/00_core.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### `timeseries_dataframe` - standardized timeseries dataframe\n",
"## `timeseries_dataframe` - standardized timeseries dataframe\n",
"\n",
"Converts Pandas dataframes and series, Numpy array's and recarrays or a dictionary of \n",
"individual timeseries into a Pandas dataframe with one datetime index. With all arrays \n",
Expand Down Expand Up @@ -167,15 +167,17 @@
" \n",
" if orient == 'records':\n",
" df = pd.DataFrame.from_records(data)\n",
" time_column = [C for C in df.columns if C.lower() in timecolumns][0]\n",
" time_column = [C for C in df.columns if C in timecolumns][0]\n",
"\n",
" elif orient == 'table':\n",
" time_column = data['schema']['primaryKey'][0]\n",
" df = pd.DataFrame.from_dict(data['data']).set_index(data['schema']['primaryKey'])\n",
" df.index.name = 'time'\n",
" else:\n",
" time_column = [C for C in df.columns if C in timecolumns][0]\n",
"\n",
"\n",
" df.columns = [C.lower() for C in df.columns]\n",
" time_column = [C for C in df.columns if C in timecolumns][0]\n",
" df.columns = list(df.columns)\n",
" df[time_column] = pd.to_datetime(df[time_column],utc=True,format='ISO8601')\n",
" df.set_index(time_column, inplace=True)\n",
" #df.index = pd.DatetimeIndex(df.index).round('ms')\n",
Expand Down Expand Up @@ -233,9 +235,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "python3",
"display_name": "corebridge.venv",
"language": "python",
"name": "python3"
"name": "corebridge.venv"
}
},
"nbformat": 4,
Expand Down

0 comments on commit ef26052

Please sign in to comment.