Pandas
Pandas : Python Data analysis tool.
Filtering records
Plotting Graphs using Data
Managing Date
destination source:https://www.plus2net.com/python/pandas.php
Pandas
DataFrame | Pandas DataFrame |
at | Get and Set data using rows and columns |
astype | Cast to a specified dtype |
cut | Using segments for categorizing values |
drop | Delete columns or rows |
describe | Descriptive statistics of DataFrame or series |
iloc | Values at different position using integer |
loc | Values at different position using column label |
filter | Condition based filtering of rows |
methods | Pandas DataFrame methods |
mask | conditional replacement of data |
query | Filtering data by using conditions |
read_sql | Using MySql records to create Pandas DataFrame |
read_csv | Reading data from csv file |
read_excel | Reading data from Excel file |
read_json | Reading data from Json file |
sort_values | Sort columns in ascending or descending |
to_sql | Using DataFrame managing MySql database |
to_csv | Saving data to CSV file |
to_json | Saving / output data in Json format |
to_excel | Saving data to Excel file |
groupby | combining data and aggregate functions |
merge | combining data and aggregate functions |
nlargest | n elements in descending sorted values |
count | Number of rows or columns with different options |
sum | Sum of values of requried axis |
set_index | Creating index using one or more columns |
max | Max value of requried axis |
min | Min value of requried axis |
reset_index | Remove index of the DataFrame |
value_counts | counts of unique values |
where | Data updation based on condition |
Exercise | Using groupby and merge of DataFrame |
Exercise1 | Basic data handling , DataFrame |
Exercise2 | Using str.contains(), max(), min(),len() of DataFrame |
Exercise3 | Using date and time functions of DataFrame |
loc | Values at different position using column label |
rows | Filtering rows based on data |
handling string using str methods
str.contains | string matching against data columns |
str.contains.sum | Max Min Sum of any column |
Convert Case | Lower 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 | Creating different type of graphs using DataFrame |
Pandas Date and time | Managing Date and time in Pandas DataFrame |
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
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')
Related Article
destination source:https://www.plus2net.com/python/pandas.php