This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
using namespace std; | |
int main() | |
{ | |
int arr[20],range,n; | |
cout<<"enter the range of elements"<<endl; | |
cin>>range; //input the range of items to be inserted | |
cout<<"enter the array"<<endl; | |
for(n=0;n<range;n++) | |
cin>>arr[n]; //input the item in array |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Perform Binary search*/ | |
#include<iostream> | |
using namespace std; | |
int search(int arr[],int size,int item); | |
int main() | |
{ | |
int arr[20]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install pandas | |
pip install tabulate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from tabulate import tabulate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from tabulate import tabulate | |
# read the csv file | |
df = pd.read_csv("raw_data.csv") | |
# displaying the DataFrame | |
print(tabulate(df, headers = 'keys', tablefmt = 'psql')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# read the csv file and parse the dates | |
df = pd.read_csv("raw_data.csv", parse_dates=['SubmissionDate', 'starttime', 'endtime']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove Time from SubmissionDate Column | |
df['Date'] = pd.to_datetime(df['SubmissionDate']).dt.date | |
print(tabulate(df[['Date', 'SubmissionDate']], headers = 'keys', tablefmt = 'psql')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Select the dataframe greater than mentioned date | |
start_date = '2020-12-04' | |
df['Date'] = (df['Date']).astype('datetime64[D]') | |
#select only particular date data | |
df = df.loc[((df['Date'] >= start_date))] | |
# Prin the dataframe | |
print(tabulate(df[['SubmissionDate', 'user_id', 'gadget']], headers = 'keys', tablefmt = 'psql')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set start and end date | |
start_date = '2020-12-04' | |
end_date = '2020-12-07' | |
# Define datatype | |
df['Date'] = (df['Date']).astype('datetime64[D]') | |
#select only particular date data | |
df = df.loc[((df['Date'] >= start_date) & (df['Date'] <= end_date))] | |
# Print the dataframe | |
print(tabulate(df[['SubmissionDate', 'user_id', 'gadget']], headers = 'keys', tablefmt = 'psql')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert Date to respective day name | |
df['Date'] = (df['Date']).astype('datetime64[D]') | |
# convert Date to day name | |
df['Day'] = df['Date'].dt.day_name() | |
df['Date'] = pd.to_datetime(df['Date']).dt.date | |
# Print the dataframe | |
print(tabulate(df[['Date', 'Day', 'user_id', 'gadget']], headers = 'keys', tablefmt = 'psql')) |
OlderNewer