hello community,
can anyone tell me is there any way to upload .csv files to CDF using Python SDK.
hello community,
can anyone tell me is there any way to upload .csv files to CDF using Python SDK.
Best answer by roman.chesnokov
import numpy as np
import pandas as pd
from cognite.client import CogniteClient
DATABASE_NAME = "db"
TABLE_NAME = "table"
CSV_FILENAME = "source.csv"
client = CogniteClient()
client.raw.databases.create(DATABASE_NAME)
client.raw.tables.create(DATABASE_NAME, TABLE_NAME)
df = pd.read_csv(CSV_FILENAME, index_col=0).fillna('')
client.raw.rows.insert_dataframe(DATABASE_NAME, TABLE_NAME, df)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.