示例#1
0
from pprint import pprint

import numpy as np
import pandas as pd

import visions as v
from visions.application.summaries import CompleteSummary

datetime_series = pd.Series([
    pd.datetime(2010, 1, 1),
    pd.datetime(2010, 8, 2),
    pd.datetime(2011, 2, 1),
    np.datetime64("NaT"),
])

# Generate a summary
summarizer = CompleteSummary()
summary = summarizer.summarize_series(datetime_series, v.DateTime)

pprint(summary)
from pprint import pprint

import numpy as np
import pandas as pd

import visions as v
from visions.application.summaries import CompleteSummary

category_series = pd.Series(
    pd.Categorical(
        [True, False, np.nan, "test"], categories=[True, False, "test", "missing"]
    )
)

# Generate a summary
summarizer = CompleteSummary()
summary = summarizer.summarize_series(category_series, v.Categorical)

pprint(summary)
示例#3
0
import numpy as np
import pandas as pd

import visions.types as vt
from visions.application.summaries import CompleteSummary

integer_series = pd.Series([1, 2, 3, 4, 5, -100000, np.nan], dtype="Int64")

summarizer = CompleteSummary()
summary = summarizer.summarize_series(integer_series, vt.Integer)
print(summary)

# Output:
# {
#     "inf_count": 0,
#     "mean": -16664.166666666668,
#     "std": 40826.05381575185,
#     "var": 1666766670.1666665,
#     "max": 5.0,
#     "min": -100000.0,
#     "median": 2.5,
#     "kurt": 5.999999974801513,
#     "skew": -2.449489736169953,
#     "sum": -99985.0,
#     "mad": 27778.611111111113,
#     "quantile_5": -74999.75,
#     "quantile_25": 1.25,
#     "quantile_50": 2.5,
#     "quantile_75": 3.75,
#     "quantile_95": 4.75,
#     "iqr": 2.5,
示例#4
0
import pandas as pd

import visions as v
from visions.application.summaries import CompleteSummary

string_series = pd.Series(["orange", "apple", "pear", "🂶", "🃁", "🂻"])

summarizer = CompleteSummary()
summary = summarizer.summarize_series(string_series, v.String)
print(summary)

# Output:
# {
#     "n_unique": 6,
#     "length": {1: 3, 6: 1, 5: 1, 4: 1},
#     "category_short_values": {
#         "o": "Ll",
#         "r": "Ll",
#         "a": "Ll",
#         "n": "Ll",
#         "g": "Ll",
#         "e": "Ll",
#         "p": "Ll",
#         "l": "Ll",
#         "🂶": "So",
#         "🃁": "So",
#         "🂻": "So",
#     },
#     "category_alias_values": {
#         "o": "Lowercase_Letter",
#         "r": "Lowercase_Letter",