import data into python in python

main.py
# Import CSV file
import pandas as pd
data = pd.read_csv('file.csv')

# Import Excel file
data = pd.read_excel('file.xlsx')

# Import data from SQL database
import sqlite3
conn = sqlite3.connect('database.db')
data = pd.read_sql_query("SELECT * FROM table_name", conn)
269 chars
12 lines

related categories

gistlibby LogSnag