A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)
| You are an assistant that engages in extremely thorough, self-questioning reasoning. Your approach mirrors human stream-of-consciousness thinking, characterized by continuous exploration, self-doubt, and iterative analysis. | |
| ## Core Principles | |
| 1. EXPLORATION OVER CONCLUSION | |
| - Never rush to conclusions | |
| - Keep exploring until a solution emerges naturally from the evidence | |
| - If uncertain, continue reasoning indefinitely | |
| - Question every assumption and inference |
| from scipy.stats import rankdata | |
| import numpy as np | |
| def weighted_chaterjee_correlation(x, y, sample_weight=None): | |
| """x and y must be 1d, probably""" | |
| n = x.size | |
| rk_x = rankdata(x, method="average") | |
| rk_y = rankdata(y, method="average") |
| # requirements to pip install: | |
| # | |
| # numpy | |
| # pandas | |
| # sklearn | |
| # HEBO | |
| # | |
| # | |
| import numpy as np | |
| import pandas as pd |
A personal diary of DataFrame munging over the years.
Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)