Powierzenie kluczy teściowej: znak zaufania, który zmienia się w próbę czystości

twojacena.pl 4 tygodni temu

**Oddanie kluczy teściowej: znak zaufania czy próba czystości?**

Moja teściowa, Bronisława Nowak, to kobieta w wieku, o surowym spojrzeniu i nieugiętym charakterze. Z mężem nie uważaliśmy jej za despotyczną czy wrogą. Wręcz przeciwnie ich relacja zawsze wydawała się serdeczna, a wobec mnie była uprzejma, choć zdystansowana. Aż do naszej ostatniej podróży do Egiptu, gdy zostawiliśmy jej klucze tylko po to, by podlewała kwiaty.

Bronisława powiedziałem przed wyjazdem macie klucze. SprawdŸcie, czy wszystko w porządku, nakarmcie złote rybki, podlejcie pelargonie. Dajcie znać, jeżeli coś się stanie.

Tydzień na plażach Hurghady był bajką: słońce, relaks, spokój. Po powrocie życie toczyło się jak zwykle praca, rutyna, wieczory przed telewizorem. Ale coś było nie tak. Filiżanka stała w innym miejscu, ręcznik złożony inaczej. Myślałem, iż to wyobraźnia. Mąż machnął ręką: Przesadzasz.

W piątek wróciłem wcześniej z pracy. W przedpokoju stały jej buty. Na wieszaku wisiał jej beżowy płaszcz. A w kuchni Bronisława, siedząc przy stole, sączyła herbatę i przeglądała nasze rachunki za prąd.

Dzień dobry powiedziałem, tłumiąc drżenie w głosie. Co tu robicie?

Podskoczyła jak oparzona:

Bartłomiej! Tak wcześnie?

Mam dzwonić przed wejściem do własnego domu? A wy?

Chciałam się upewnić, iż wszystko gra. I mam ci coś do powiedzenia.

Potem było jak w absurdalnym teatrze. Wskazała kurz pod półką, przejrzała lodówkę wzrokiem sanepidu i oznajmiła:

Gdzie jest rosół? Mięso duszone? Nie karmicie mojego syna jak należy! Wcześniej był zadbany, najedzony. Teraz? Wraca zmęczony do zimnego domu. Następnym razem chcę lodówkę pełną domowych dań. A ten bałagan Tu się nie da odd# UFC Dataset Analysis

## Introduction
This project analyses a dataset from **Kaggle** of **UFC**(Ultimate Fighting Championship), which contains details of the competition held between 1994 and 2019. Dataset includes information about both the fighters and the fights. Each row describes one fight and contains both the fighter and UFC related information.

## Libraries used
This analysis uses several *Python* libraries, including:

– **pandas:** A powerful data manipulation and analysis library.
– **matplotlib.pyplot & seaborn:** Data visualization libraries.
– **numpy:** A library for numerical computing in Python.
– **datetime:** A module for manipulating dates and times.
– **warnings:** A module to control warning messages.

## Data Loading and Initial Checks
The project begins by loading the dataset using **pandas** and performing an initial check to understand the data structure, columns, and missing values.

„`python
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
from datetime import datetime
import warnings
warnings.filterwarnings(’ignore’)

ufc_df = pd.read_csv(„ufc.csv”)

print(„First 5 rows of the dataset:”)
print(ufc_df.head())
print(„\nBasic info about the dataset:”)
print(ufc_df.info())
print(„\nSummary statistics for numerical columns:”)
print(ufc_df.describe())
print(„\nMissing values in each column:”)
print(ufc_df.isna().sum())
„`

## Data Cleaning
The data cleaning process involves:

1. **Handling Missing Values:**
– Checking for missing values in each column.
– Imputing missing values where possible or deciding to drop them.
– Filling missing numerical values with the mean or median.

2. **Filling Missing Numerical and Categorical Values:**
For numerical columns, missing values are filled with the median if the column is skewed or with the mean if the distribution is symmetric.
For categorical columns, missing values are filled with the mode (most frequent category).

3. **Converting Date Columns:**
– Converting date columns to datetime format for easier manipulation.
– Extracting useful features like the month and year from date columns.

4. **Dropping Redundant or Irrelevant Columns:**
– Identifying and dropping columns that do not contribute to the analysis or have too many missing values.

„`python
print(„\nMissing values in each column before cleaning:”)
print(ufc_df.isna().sum())

ufc_df[’weight_class’] = ufc_df[’weight_class’].fillna(ufc_df[’weight_class’].mode()[0])

numerical_cols = ufc_df.select_dtypes(include=[’int64′, 'float64′]).columns
for col in numerical_cols:
if ufc_df[col].isna().sum() > 0:
ufc_df[col] = ufc_df[col].fillna(ufc_df[col].median())

ufc_df[’date’] = pd.to_datetime(ufc_df[’date’])
ufc_df[’year’] = ufc_df[’date’].dt.year
ufc_df[’month’] = ufc_df[’date’].dt.month

print(„\nMissing values in each column after cleaning:”)
print(ufc_df.isna().sum())
„`

## Exploratory Data Analysis (EDA)
The EDA phase involves:

1. **Visualizing the Distribution of Fights Over Time:**
– Creating line plots to show the number of fights per year.
– Identifying trends or anomalies in fight frequency.

2. **Analyzing Fight Outcomes:**
– Using bar plots to visualize the distribution of different fight outcomes (e.g., KO, submission, decision).
– Understanding which outcomes are most common.

3. **Examining Fighter Characteristics:**
– Comparing the reach, height, and age of winners vs. losers.
– Using box plots and histograms to analyze these distributions.

4. **Weight Class Analysis:**
– Counting the number of fights in each weight class.
– Visualizing the popularity of different weight classes.

„`python
plt.figure(figsize=(12, 6))
sns.countplot(x=’year’, data=ufc_df, palette=’viridis’)
plt.title(’Number of Fights per Year’)
plt.xlabel(’Year’)
plt.ylabel(’Number of Fights’)
plt.xticks(rotation=45)
plt.show()

plt.figure(figsize=(12, 6))
sns.countplot(x=’weight_class’, data=ufc_df, palette=’viridis’, order=ufc_df[’weight_class’].value_counts().index)
plt.title(’Number of Fights per Weight Class’)
plt.xlabel(’Weight Class’)
plt.ylabel(’Number of Fights’)
plt.xticks(rotation=90)
plt.show()

plt.figure(figsize=(12, 6))
ufc_df[’Winner’].value_counts().head(10).plot(kind=’bar’, color=’skyblue’)
plt.title(’Top 10 UFC Fighters with Most Wins’)
plt.xlabel(’Fighter Name’)
plt.ylabel(’Number of Wins’)
plt.xticks(rotation=45)
plt.show()
„`

## Advanced Analysis
The project also includes more advanced analyses:

1. **Correlation Analysis:**
– Calculating and visualizing the correlation between numerical variables.
– Identifying if certain fighter attributes (e.g., reach, height) are correlated with winning.

2. **Temporal Trends:**
– Analyzing how fighter attributes have changed over time.
– Checking if there are trends in reach, height, or age over the years.

3. **Outcome by Weight Class:**
– Exploring how fight outcomes vary by weight class.
– Using grouped bar plots to compare outcomes across different weight classes.

„`python
numeric_cols = [’R_Reach_cms’, 'B_Reach_cms’, 'R_Height_cms’, 'B_Height_cms’, 'R_age’, 'B_age’, 'R_Weight_lbs’, 'B_Weight_lbs’]
corr = ufc_df[numeric_cols].corr()

plt.figure(figsize=(10, 8))
sns.heatmap(corr, annot=True, cmap=’coolwarm’, fmt=”.2f”)
plt.title(’Correlation Matrix for Numeric Columns’)
plt.show()
„`

## Insights and Conclusion
The analysis provides several insights:

1. **Trend in UFC Fights:**
– The number of UFC fights has significantly increased over the years, peaking around **2014-2019**.

2. **Popular Weight Classes:**
– **Lightweight** and **Welterweight** are the most frequent weight classes.

3. **Winning Attributes:**
– Fighters with greater **reach** and **height** tend to have a higher chance of winning.
Następnego dnia znalazłem na stole słoik domowego bigosu z karteczką: „Powiedz Markowi, iż to twój będzie zachwycony!”.

Idź do oryginalnego materiału