Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import numpy as np
- import matplotlib.pyplot as plt
- import seaborn as sns
- # Known total production of Panzer III tanks
- total_production = 5774
- # Monthly production data (approximation, replace with actual data if available)
- # Assuming production started in January 1939 and ended in December 1943
- months = pd.date_range(start='1939-01-01', end='1943-12-31', freq='M')
- monthly_production = np.random.poisson(lam=total_production/len(months), size=len(months))
- # Adjust monthly production to ensure the total matches the known production number
- monthly_production = np.round(monthly_production * (total_production / monthly_production.sum())).astype(int)
- monthly_data = {
- 'Month': months,
- 'Production': monthly_production
- }
- variant_data = {
- 'Variant': ['Ausf. E', 'Ausf. F', 'Ausf. G', 'Ausf. H', 'Ausf. J'],
- 'Units': [1200, 1300, 1800, 2000, 2000] # Example units, adjust based on actual data
- }
- # Adjust variant units to match the total production
- variant_total = sum(variant_data['Units'])
- variant_data['Units'] = np.round(np.array(variant_data['Units']) * (total_production / variant_total)).astype(int)
- # Create DataFrames
- df_monthly = pd.DataFrame(monthly_data)
- df_variant = pd.DataFrame(variant_data)
- # Calculate proportion of each variant
- variant_total = df_variant['Units'].sum()
- df_variant['Proportion'] = df_variant['Units'] / variant_total
- # Adjust for shortages (example shortage factors)
- shortage_factors = {
- 'manpower': 0.15, # 15% reduction
- 'material': 0.10 # 10% reduction for specific variants
- }
- # Adjust monthly production for shortages
- df_monthly['Production_Adjusted'] = df_monthly['Production'] * (1 - shortage_factors['manpower'])
- # Adjust variant production for material shortages
- df_variant['Units_Adjusted'] = df_variant['Units'] * (1 - shortage_factors['material'])
- # Output results
- print("\nAdjusted Monthly Production:")
- print(df_monthly)
- print("\nAdjusted Variant Production:")
- print(df_variant)
- # Example of serial number analysis
- serial_numbers = np.arange(101, 5875) # Example serial numbers (replace with actual data if available)
- highest_serial_number = serial_numbers[-1]
- print(f"Highest Serial Number: {highest_serial_number}")
- # Estimate total production based on highest serial number
- estimated_total_production = highest_serial_number + 1 # +1 if considering the last number observed
- print(f"Estimated Total Production (based on serial numbers): {estimated_total_production} tanks")
- # Estimate total production for each variant (assuming the same proportion)
- df_variant['Estimated_Units'] = df_variant['Proportion'] * estimated_total_production
- print("\nEstimated Variant Production:")
- print(df_variant)
- # Plotting Monthly Production
- plt.figure(figsize=(16, 8))
- # Plot Aggregated Data
- plt.subplot(1, 2, 1)
- sns.lineplot(x='Month', y='Production', data=df_monthly, marker='o', label='Original Production')
- sns.lineplot(x='Month', y='Production_Adjusted', data=df_monthly, marker='o', color='red', linestyle='--', label='Adjusted Production')
- plt.title('Monthly Production of Panzer III Tanks (1939-1943)')
- plt.xlabel('Month')
- plt.ylabel('Production')
- plt.xticks(rotation=45)
- plt.grid(True)
- plt.legend()
- # Plot Variant Production
- plt.subplot(1, 2, 2)
- sns.barplot(x='Variant', y='Units', data=df_variant, color='blue', label='Original Units')
- sns.barplot(x='Variant', y='Units_Adjusted', data=df_variant, color='red', alpha=0.5, label='Adjusted Units')
- plt.title('Production by Variant')
- plt.xlabel('Variant')
- plt.ylabel('Units')
- plt.legend()
- plt.tight_layout()
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement