<jupyter_start><jupyter_text>A solution for Data Importation issue " Databases and SQL for Data Science Week 4"this a simple solution for Data importation issue, in wich I change the date format to "YYYY-MM-DD HH:mm:ss"  About the Author:**<NAME>**  a software engineer   LinkedIn   GitHub  CSV Importation<jupyter_code>import pandas as pd

url="https://ibm.box.com/shared/static/svflyugsr9zbqy5bmowgswqemfpm1x7f.csv"
df=pd.read_csv(url)
df.head()<jupyter_output><empty_output><jupyter_text>Date's columns visualization<jupyter_code>columns = ['DATE','UPDATEDON']
df_date = df[columns]
df_date.head()<jupyter_output><empty_output><jupyter_text>Date transformation<jupyter_code>import datetime
df['DATE']=pd.to_datetime(df.DATE).dt.strftime('%Y-%m-%d')
df['UPDATEDON']=pd.to_datetime(df.UPDATEDON).dt.strftime('%Y-%m-%d %H:%M:%S')
df.head()<jupyter_output><empty_output><jupyter_text>Save new csv file<jupyter_code>file_name= 'Chicago_Crime_Data-formated.csv';
df.to_csv(file_name, index = False)<jupyter_output><empty_output><jupyter_text>Save new CSV in IBM Storage  configuration<jupyter_code># @hidden_cell
credentials ={
  "apikey": "<KEY>",
  "cos_hmac_keys": {
    "access_key_id": "<KEY>",
    "secret_access_key": "5e5965ff24b1d1df9c374b6aeccdde5e98950ef1767013fa"
  },
  "endpoints": "https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints",
  "iam_apikey_description": "Auto-generated for key <KEY>",
  "iam_apikey_name": "Pyhon-Analysis-week5",
  "iam_role_crn": "crn:v1:bluemix:public:iam::::serviceRole:Manager",
  "iam_serviceid_crn": "crn:v1:bluemix:public:iam-identity::a/5ce679ad625c4b5d82e579cfbf861de3::serviceid:ServiceId-6f8dca1a-4786-470b-8754-ae5221f4e22b",
  "resource_instance_id": "crn:v1:bluemix:public:cloud-object-storage:global:a/5ce679ad625c4b5d82e579cfbf861de3:c841a833-201b-4279-b330-12873044a5ef::"
}
endpoint = 'https://s3.eu.cloud-object-storage.appdomain.cloud'
bucket_name = 'pythonfordatascienceandaiweek5-donotdelete-pr-p5uzzqzsa6yzxc'
import boto3

resource = boto3.resource(
    's3',
    aws_access_key_id = credentials["cos_hmac_keys"]['access_key_id'],
    aws_secret_access_key = credentials["cos_hmac_keys"]["secret_access_key"],
    endpoint_url = endpoint,
)
import os

directory = os.getcwd()
file_path = directory + "/" + file_name
f = open(file_path,'r')<jupyter_output><empty_output><jupyter_text>writing new csv in ibm cloud storage<jupyter_code>resource.Bucket(name=bucket_name).put_object(Key=file_name, Body=f.read())
Params = {'Bucket':bucket_name ,'Key':file_name }
import sys
time = 7*24*60**2
client = boto3.client(
    's3',
    aws_access_key_id = credentials["cos_hmac_keys"]['access_key_id'],
    aws_secret_access_key = credentials["cos_hmac_keys"]["secret_access_key"],
    endpoint_url=endpoint,

)<jupyter_output><empty_output><jupyter_text>Printing the new csv URL<jupyter_code>url = client.generate_presigned_url('get_object',Params=Params,ExpiresIn=time)
print(url)<jupyter_output>https://s3.eu.cloud-object-storage.appdomain.cloud/pythonfordatascienceandaiweek5-donotdelete-pr-p5uzzqzsa6yzxc/Chicago_Crime_Data-formated.csv?AWSAccessKeyId=<KEY>&Signature=zfubg5SzvQ0z9fwcVK2NuPoAZzU%3D&Expires=1570450643
{'fraction_non_alphanumeric': 0.13998744507219082, 'fraction_numerical': 0.0480225988700565, 'mean_word_length': 8.456973293768545, 'pattern_counts': {'":': 10, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '506117', 'license': 'MIT', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1274, 'n_words': 149, 'path': 'Databases and SQL for Data Science Week 4.ipynb', 'repo_name': 'gouzal/coursera-issues', 'size': '3316'}