36
loading...
This website collects cookies to deliver better user experience
Source — Stack Overflow
pandas.read_csv
function.filepath_or_buffer
include sep,delimiter,header, index_col
e.t.cfrom pyforest import *
df = pd.read_csv("cereal.csv")
df.head()
from pyforest import *
df = pd.read_csv("cereal_tab.csv",sep='\t')
df.head()
from pyforest import *
df = pd.read_csv("cereal_semicolon.csv",sep=';')
df.head()
from pyforest import *
from sqlalchemy import create_engine
# provide a connection string/URL
db_connection_str = "mysql+mysqlconnector://mysql_username:mysql_user_password@localhost/mysql_db_name"
# produce an Engine object based on a URL
db_connection = create_engine(db_connection_str)
# read SQL query or database table into a DataFrame.
df = pd.read_sql('SELECT * FROM table_name', con=db_connection)
# return the first 5 rows of the dataframe
df.head()
Source — Stack Overflow
from pyforest import *
from sqlalchemy import create_engine
# produce an Engine object based on a postgresql database URL
engine = create_engine("postgresql:///psql_dbname")
# read SQL query or database table into a DataFrame.
df = pd.read_sql('select * from "user"',con=engine)
# return the first 5 rows of the dataframe
df.head()
from pyforest import *
from sqlalchemy import create_engine
# connect to a database
engine = create_engine("sqlite:///database.db")
# read database data into a pandas DataFrame
df = pd.read_sql('select * from user', engine)
# return the first 5 rows of the dataframe
df.head()
pandas.read_json
function transforms a JSON string to a pandas object with ease. The first parameter it accepts is path_or_bufa
, which must be a valid JSON str, path object, or file-like object. This function also has a number of other parameters that it takes.from pyforest import *
df = pd.read_json('cereal_default.json')
df.head()