Snippets Collections
import dtale
from pandas_profiling import ProfileReport
from dataprep.eda import create_report

class AutomateEDA:
    
    def __init__(self, df):
        self.df = df
     
    def show_dtale(self):
        d = dtale.show(self.df)
        d.open_browser()
        print('dtale opened in browser!')
        
    def show_pandas_profile_report(self):
        profile = ProfileReport(self.df, title="Pandas Profiling Report", explorative=True)
        profile.to_file("pandas-profiling-report.html")
        print('pandas-profile-report created and saved in the project folder!')
        
    def show_dataprep(self):
        create_report(self.df).show_browser()
        print('dataprep opened in browser!')
        
    def show_all(self):
        self.show_dtale()
        self.show_dataprep()
        self.show_pandas_profile_report();


eda = AutomateEDA(df)
eda.show_all()
import pandas as pd
data = pd.read_csv('../input/udemy-courses/udemy_courses.csv')

x = pd.Series([int(i[:4]) for i in data.published_timestamp])
xx = pd.DataFrame(x,columns=['published_year'])
z = pd.Series([int(i[5:7]) for i in data.published_timestamp])
zz = pd.DataFrame(z,columns=['published_day'])

data = pd.concat([data,xx,zz],axis=1)
data
   let User = Auth.auth().currentUser
        if let user = User{
            let db = Firestore.firestore()
            db.collection("Appointments").whereField("patient_id", isEqualTo: user.uid).getDocuments { [self] (document, error) in
                guard let data = document?.documents else {
                    return
                }
                      for d in data{
                    self.chatStatus = d.get("chat_status") as? String ?? ""
                    self.startTime = d.get("start_time") as? String ?? ""
                }
                      //updating data
                    let document = document!.documents.first
                    document?.reference.updateData([
                                   "chat_status": "Started"
                               ])
@IBAction func saveChangesPressed(_ sender: UIButton) {
        
        let user = Auth.auth().currentUser
        if let user = user {
            let db = Firestore.firestore()
            let docRef = db.collection("Users").document(user.uid)
            docRef.updateData(["Name": self.nameField.text ?? "User","Email": self.emailField.text ?? "a@gmail.com", "MobileNumber": self.phoneNumberField.text ?? "123"])
        }
    }
func getDataFromFireStore() {
        print("getting data")
        let activityView = activityIndicatorView()
        activityView.startAnimating()
        let db = Firestore.firestore()
        db.collection("Activities").getDocuments() { (querySnapshot, error) in
            if error != nil {
                print("Error getting documents: \(error!)")
            } else {
                self.activitiesArray.removeAll()
                for document in querySnapshot!.documents {
                    print("for loop")
                    let activities = ActivitiesModel()
                    let data = document.data()
                    activities.title = data["title"] as! String
                    activities.description = data["description"] as! String
                    activities.image_url = data["image_url"] as! String
                    self.activitiesArray.append(activities)
                }
                activityView.stopAnimating()
                self.activitiesTableView.reloadData()
            }
        }
        
    }
def log_scale(x):
    C = 1 / np.log(10)
    return np.sign(x) * np.log10(1 + np.abs(x / C))
df['Purchase'] = df['Purchase'].apply(lambda x: 1 if x=='Yes' else 0)
df2.loc[["one",'three'],['pop','state']]
df2.loc["one":'three'],['pop','state']]
df2.loc[:'three',['pop','state']]
df.apply(lambda x: x == ' ', axis = 1).mean()
df.loc[df.TotalCharges == ' ', :]
df.loc[df.TotalCharges == ' ', 'TotalCharges'] = 0
def detect_outliers(df,n,features): 
    outlier_indices = []
    for col in features:
        Q1 = np.percentile(df[col],25)
        Q3 = np.percentile(df[col],75)
        IQR = Q3 - Q1
        outlier_step = 1.5 * IQR 
        outlier_list_col = df[(df[col] < Q1 - outlier_step) | (df[col] > Q3 + outlier_step)].index
        outlier_indices.extend(outlier_list_col)

    outlier_indices = Counter(outlier_indices)
    multiple_outliers = list(k for k, v in outlier_indices.items() if v>n)
    return multiple_outliers

Outliers_to_drop = detect_outliers(data1,2,['Age','Parch','Fare','SibSp'])
data1.iloc[Outliers_to_drop]
import tkinter as tk
from tkinter import ttk

root = tk.Tk()

# Pack a big frame so, it behaves like the window background
big_frame = ttk.Frame(root)
big_frame.pack(fill="both", expand=True)

# Set the initial theme
root.tk.call("source", "sun-valley.tcl")
root.tk.call("set_theme", "light")

def change_theme():
    # NOTE: The theme's real name is sun-valley-<mode>
    if root.tk.call("ttk::style", "theme", "use") == "sun-valley-dark":
        # Set light theme
        root.tk.call("set_theme", "light")
    else:
        # Set dark theme
        root.tk.call("set_theme", "dark")

# Remember, you have to use ttk widgets
button = ttk.Button(big_frame, text="Change theme!", command=change_theme)
button.pack()

root.mainloop()
from google.colab import drive
drive.mount('/content/drive/')
import sys
sys.path.insert(0,'/content/drive/MyDrive/')
train_df = pd.read_csv("/content/drive/MyDrive/train.csv")
var endExperiment = function() {

  prompt_resubmit = function() {
    replaceBody(error_message);
    $("#resubmit").click(resubmit);
  };

  resubmit = function() {
    replaceBody("<h1>Trying to resubmit...</h1>");
    reprompt = setTimeout(prompt_resubmit, 10000);
    
    psiTurk.saveData({
      success: function() {
          clearInterval(reprompt); 
      }, 
      error: prompt_resubmit
    });
  };
  // Load the debriefing page 
  psiTurk.showPage('debriefing.html');

  //code for bonus??
  $("#next").click(function () {
      record_responses();
      psiTurk.saveData({
            success: function(){
                psiTurk.computeBonus('compute_bonus', function() { 
                  psiTurk.completeHIT(); // when finished saving compute bonus, the quit
                }); 
            }, 
            error: prompt_resubmit});
  });
#importing Autoviz class
from autoviz.AutoViz_Class import AutoViz_Class#Instantiate the AutoViz class
AV = AutoViz_Class()

df = AV.AutoViz('car_design.csv')
# Discretization
df3["Total_Amt_Chng_Q4_Q1_qcut"]=pd.qcut(df3["Total_Amt_Chng_Q4_Q1"],4)
df3["Total_Trans_Amt_qcut"]=pd.qcut(df3["Total_Trans_Amt"],4)
df3["Total_Ct_Chng_Q4_Q1_qcut"]=pd.qcut(df3["Total_Ct_Chng_Q4_Q1"],4)
star

Mon Jan 10 2022 06:37:19 GMT+0000 (UTC)

#ios #swift #update #updatedata #data
star

Sun Nov 14 2021 22:23:48 GMT+0000 (UTC)

#data
star

Sun Nov 07 2021 21:16:28 GMT+0000 (UTC)

#data
star

Fri Nov 05 2021 21:39:10 GMT+0000 (UTC)

#data
star

Sat Oct 16 2021 20:01:06 GMT+0000 (UTC)

#data
star

Fri Aug 13 2021 08:28:34 GMT+0000 (UTC)

#colab #drive #data
star

Wed Jun 02 2021 18:58:00 GMT+0000 (UTC) https://stackoverflow.com/questions/61445528/how-to-save-data-from-app-engine-to-datastore-google-cloud-javascript

#data #javascript #jspsych
star

Wed Jun 02 2021 17:37:05 GMT+0000 (UTC) https://github.com/danieljwilson/ObjectVsTask

#js #jspsych #data #saving
star

Wed Jun 02 2021 17:05:03 GMT+0000 (UTC) https://github.com/colinquirk/psiturkParser

##js #js #javascript #psiturk #data
star

Thu May 27 2021 02:56:24 GMT+0000 (UTC) https://towardsdatascience.com/autoviz-automatically-visualize-any-dataset-75876a4eede4

#python #data #visualisation #graphs #plots #charts #dashboards
star

Sat Oct 31 2020 05:07:34 GMT+0000 (UTC) https://css-tricks.com/a-complete-guide-to-data-attributes/

#data-atribute #data

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension