A Pen by Captain Anonymous on CodePen.
This file contains 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
# pandas DataFrame iterate rows and assign to new column test | |
# - data size : 329 rows | |
# - unique of index one : 91 | |
# - unique of index one : 329 | |
# - iteration way | |
# - using index | |
# - make sub df one depth | |
# - make sub df two depth | |
# - using df index | |
# - groupby one level |
This file contains 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
# df : len(unique(index.id1)) 16000, len(unique(index.id1)) 67000 | |
# loop for id2 | |
# test 1. make sub df for id2 | |
A = time.time() | |
for id2 in df.index.get_level_values('id2'): | |
df_id2 = df.loc[df.index.get_level_values('id2') == id2] | |
This file contains 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 org.apache.spark.sql.types.{IntegerType, StructField, StructType} | |
import org.apache.spark.sql.Row | |
val df = sc.parallelize(Seq( | |
(1.0, 2.0), (0.0, -1.0), | |
(3.0, 4.0), (6.0, -2.3))).toDF("x", "y") | |
def transformRow(row: Row): Row = Row.fromSeq(row.toSeq ++ Array[Any](-1, 1)) | |
def transformRows(iter: Iterator[Row]): Iterator[Row] = iter.map(transformRow) |
This file contains 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
""" | |
index : (group, id) 이며 group : id 는 1 : m | |
value : 0 ~ 1 사이의 값이며 group 내에서 각 객체 간의 상대적인 비율값 | |
- id의 value가 1 이면 group 내에서 가장 큰 값 | |
- id의 value가 0.5이면 group내에서 가장 큰 값의 0.5배에 해당하는 값 | |
value에 nan 값이 있는데 이것에 적절한 값을 넣어야 함. 그냥 삭제처리 할 경우 전체적인 데이터가 원하는데로 안나옴 | |
rate에는 nan 값이 없으며 group 내에서 0 ~ 1 사이에 값을 가짐. value와는 다른 기준으로 작성된 데이터 |
This file contains 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
'use strict'; | |
const textNode = (text, target) => { | |
if (text.length) { | |
target.push({type: 'TEXT', text}) | |
} | |
return ''; | |
}; | |
const parseAttribute = name => { |
This file contains 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
using System; | |
using System.Collections.Generic; | |
using System.Threading.Tasks; | |
using System.Windows.Forms; | |
namespace FormTestUsingAsync | |
{ | |
public partial class Form1 : Form | |
{ | |
public DataManager DataManager = new DataManager(); |
This file contains 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 <thread> | |
#include <future> | |
#include <exception> | |
#include <chrono> | |
#include <iostream> | |
class interrupt_flag | |
{ | |
std::atomic<bool> flag; | |
std::condition_variable* thread_cond; |
This file contains 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 <thread> | |
#include <future> | |
#include <exception> | |
#include <chrono> | |
#include <iostream>> | |
class interrupt_flag | |
{ | |
std::atomic<bool> flag; | |
std::condition_variable* thread_cond; |
This file contains 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 <thread> | |
#include <future> | |
#include <exception> | |
#include <chrono> | |
#include <iostream>> | |
class interrupt_flag | |
{ | |
std::atomic<bool> flag; | |
std::condition_variable* thread_cond; |
NewerOlder