A.2.3.2 How to upload data from a .csv file into a Pandas DataFrame
How to upload data from a .csv file into a Pandas DataFrame
For example, how can I upload data from a .csv
file into a Pandas
DataFrame?
Resolution: To import the data from this
IRIS.csv
file present in Object Storage, and read into a Pandas
DataFrame, run the following
command:%python
import pandas as pd
import ssl
url="https://objectstorage.us-ashburn-1.oraclecloud.com/n/adwc4pm/b/OML_Data/o/IRIS.csv"
ssl._create_default_https_context = ssl._create_unverified_context
test = pd.read_csv(url)
test.head()
To fetch the same information for R, use
read.csv()
instead. Run the following
command:%r
url="https://objectstorage.us-ashburn-1.oraclecloud.com/n/adwc4pm/b/OML_Data/o/IRIS.csv"
test = read.csv(url)
head(test)
Parent topic: OML Notebooks