Importamos la librería y DataSets necesarios
import pandas as pd
import numpy as np
dir_pandas = '/datasets/drive/Colab Notebooks/Datasets/{}'
todoist=pd.read_csv(dir_pandas.format('todoist.csv'))
Hacemos una previsualización de nuestros datos
todoist.sample(10)
copi_todoist=todoist.iloc[:,[0,3,8,10]]
copi_todoist
copi_todoist.rename(columns={'id':'tarea'}, inplace=True)
copi_todoist.rename(columns={'checked':'completado'}, inplace=True)
copi_todoist.rename(columns={'date_string':'fecha_creacion'}, inplace=True)
copi_todoist.rename(columns={'due_date':'fecha_vencimiento'}, inplace=True)
/shared-libs/python3.7/py/lib/python3.7/site-packages/pandas/core/frame.py:4449: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
errors=errors,
copi_todoist.sample(10)
Limpiar DataFrame
clear_todoist=copi_todoist.dropna(axis=0)
clear_todoist
clear_todoist['fecha_vencimiento']=pd.to_datetime(clear_todoist['fecha_vencimiento'])
clear_todoist['hour']=clear_todoist['fecha_vencimiento'].dt.hour
clear_todoist
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:1: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
"""Entry point for launching an IPython kernel.
/shared-libs/python3.7/py-core/lib/python3.7/site-packages/ipykernel_launcher.py:2: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
Graficando los datos
clear_todoist
hora_productivas=clear_todoist[clear_todoist['hour']!=2]
hora_productivas
hora_productivas