Pandas

Pandas : Python Data analysis tool.
DataFramePandas DataFrame
ilocValues at different position using integer
locValues at different position using column label
filterCondition based filtering of rows
methodsPandas DataFrame methods
read_sqlUsing MySql records to create Pandas DataFrame
read_csvReading data from csv file
read_excelReading data from Excel file
read_jsonReading data from Json file
sort_valuesSort columns in ascending or descending
to_sqlUsing DataFrame managing MySql database
to_csvSaving data to CSV file
to_jsonSaving / output data in Json format
to_excelSaving data to Excel file
groupbycombining data and aggregate functions
mergecombining data and aggregate functions
countNumber of rows or columns with different options
sumSum of values of requried axis
maxMax value of requried axis
minMin value of requried axis
astypeCast to a specified dtype
ExerciseUsing groupby and merge of DataFrame
Exercise2Using str.contains(), max(), min(),len() of DataFrame
Filtering records
locValues at different position using column label
rowsFiltering rows based on data

handling string using str methods

str.containsstring matching against data columns
str.contains.sumMax Min Sum of any column
Convert CaseLower to Upper and vice versa
split()Breaking string using delimiter
slice()Substring by breaking string
cat()Concatenate strings
count()Number of occurences of pattern
replace()Replace part of string by regex
len()Length of the data in our DataFrame
Plotting Graphs using Data
Plotting graphsCreating different type of graphs using DataFrame

Excel to MySQL

Excel to MySQL
import pandas as pd 
my_data = pd.read_excel('D:\emp.xlsx')
# reading data from root of D drive. 
from sqlalchemy import create_engine
engine = create_engine("mysql+mysqldb://userid:password@localhost/my_tutorial")

### Creating new table emp or appending existing table 
my_data.to_sql(con=engine,name='emp',if_exists='append')

MySQL to Excel

MySQL to Excel
import pandas as pd 

from sqlalchemy import create_engine
engine = create_engine("mysql+mysqldb://userid:password@localhost/my_tutorial")

sql="SELECT * FROM emp "
my_data = pd.read_sql(sql,engine )

my_data.to_excel('D:\emp2.xlsx')
Pandas DataFrame


plus2net.com



Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2020 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer