Skip to content

Instantly share code, notes, and snippets.

@SmartDataWithR
SmartDataWithR / heart.csv
Created January 17, 2023 16:05
Heart Disease
Age Sex ChestPainType RestingBP Cholesterol FastingBS RestingECG MaxHR ExerciseAngina Oldpeak ST_Slope HeartDisease
40 M ATA 140 289 0 Normal 172 N 0 Up 0
49 F NAP 160 180 0 Normal 156 N 1 Flat 1
37 M ATA 130 283 0 ST 98 N 0 Up 0
48 F ASY 138 214 0 Normal 108 Y 1.5 Flat 1
54 M NAP 150 195 0 Normal 122 N 0 Up 0
39 M NAP 120 339 0 Normal 170 N 0 Up 0
45 F ATA 130 237 0 Normal 170 N 0 Up 0
54 M ATA 110 208 0 Normal 142 N 0 Up 0
37 M ASY 140 207 0 Normal 130 Y 1.5 Flat 1
@SmartDataWithR
SmartDataWithR / MostPopularProgrammingLanguages.csv
Created January 12, 2023 05:17
PopularLanguagesWithFileReference
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 29 columns, instead of 28. in line 4.
Date,Abap,Ada,C/C++,C#,Cobol,Dart,Delphi/Pascal,Go,Groovy,Haskell,Java,JavaScript,Julia,Kotlin,Lua,Matlab,Objective-C,Perl,PHP,Python,R,Ruby,Rust,Scala,Swift,TypeScript,VBA,Visual Basic
July 2004,0.33999999999999997,0.36,10.08,4.71,0.43,0,2.82,0,0.03,0.22,30.37,8.649999999999999,0,0,0.16,2.11,0.19,7.380000000000001,18.75,2.53,0.38999999999999996,0.33,0.08,0.03,0,0,1.44,8.559999999999999
August 2004,0.36,0.36,9.81,4.99,0.45999999999999996,0,2.67,0,0.06999999999999999,0.2,29.99,8.780000000000001,0,0,0.15,2.0500000000000003,0.18,7.109999999999999,19.259999999999998,2.64,0.41000000000000003,0.4,0.09,0.03,0,0,1.46,8.57
September 2004,0.41000000000000003,0.41000000000000003,9.629999999999999,5.06,0.51,0,2.65,0,0.08,0.21,29.709999999999997,8.7,0,0,0.19,2.11,0.19,7.03,19.49,2.7199999999999998,0.4,0.41000000000000003,0.1,0.03,0,0,1.55,8.41
October 2004,0.4,0.38,9.5,5.3100000000000005,0.53,0,2.77,0,0.09,0.2,29.12,8.469999999999999,0,0,0.22,2.2399999999999998,0.2,7.17,19.34,2.92,0.42,0.45999999999999996,0.11,0.04,0,0,1.
@SmartDataWithR
SmartDataWithR / dygraph_final.html
Created December 18, 2022 16:01
Dygraph Rendered Document
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
@SmartDataWithR
SmartDataWithR / data_prep.py
Created December 10, 2022 14:50
ObjectDetectionWithYoloV7
#%% package import
import pandas as pd
import numpy as np
import seaborn as sns
import os
import shutil
import xml.etree.ElementTree as ET
import glob
import json
@SmartDataWithR
SmartDataWithR / python.json
Created November 26, 2022 15:02
Snippet: Advanced Snippet
{
"Filter DataFrame": {
"prefix": "df_filt",
"body": [
"${1:df_filt} = ${2:df_raw}[${2:df_raw}['${3:Column}'] ${4|==, >, >=, <, <=, !=|} ${5:Filter}] "
],
"description": "Filter a Pandas DataFrame"
}
}
@SmartDataWithR
SmartDataWithR / python.json
Created November 26, 2022 14:34
Snippet: Simple Snippet
{
"Import Packages": {
"prefix": "import_typical",
"body": [
"#%% package import",
"import numpy as np",
"import pandas as pd",
"import matplotlib.pyplot as plt"
],
"description": "Import typical packages"
@SmartDataWithR
SmartDataWithR / data_prep.py
Created November 7, 2022 06:40
SentimentArticle: test model
#%% test model
test_sentences = ['How many Democrats does it take to screw in a light bulb? Just one, but it really gets screwed.', 'A conservative is a man who sits and thinks; mostly sits.']
nlp_model(test_sentences)
@SmartDataWithR
SmartDataWithR / sentiment_report.qmd
Created November 6, 2022 18:50
SentimentArticle: List of sentences and polarities
president = 'Trump'
df_filt = df.loc[df['source']==president, ['text', 'stars']].copy()
list(zip(df_filt['text'], df_filt['stars']))
@SmartDataWithR
SmartDataWithR / sentiment_report.qmd
Created November 6, 2022 18:42
SentimentArticle: Stars Count
fig = px.bar(df_grouped[df_grouped['source']==president],
x="stars", y="count", color="stars",
color_discrete_sequence= px.colors.sequential.Plasma_r
)
fig.show()
@SmartDataWithR
SmartDataWithR / sentiment_report.qmd
Created November 6, 2022 18:37
SentimentArticle: polar barplot
president = 'Trump'
fig = px.bar_polar(df[df['source']==president], r="stars", theta="direction",
color="stars",
hover_name="text",
color_discrete_sequence= px.colors.sequential.Plasma_r
)
fig.show()