Retour au blog
Data AnalysisAI ToolsBusiness Intelligence

AI-Powered Data Analysis: From Spreadsheets to Insights

212AY Team·2026-04-20·11 min
import pandas as pd
import matplotlib.pyplot as plt
from openai import OpenAI

client = OpenAI()

def analyze_dataframe(df, question):
    # Get dataframe info
    info = f"Columns: {list(df.columns)}\n"
    info += f"Shape: {df.shape}\n"
    info += f"Sample:\n{df.head().to_string()}"
    
    response = client.chat.completions.create(
        model="gpt-4",
        messages=[
            {"role": "system", "content": "Analyze this data and answer the question. Include Python code if relevant."},
            {"role": "user", "content": f"Data:\n{info}\n\nQuestion: {question}"}
        ]
    )
    return response.choices[0].message.content

Use Case: Moroccan E-commerce

A small business in Marrakech used AI to analyze their sales data and discovered:

  • 60% of revenue came from returning customers (not new)
  • Their best-selling products had predictable seasonal dips
  • WhatsApp was their most effective marketing channel

They adjusted their strategy and increased revenue by 35% in one quarter.

Articles récents

Analyse de données avec IA : des tableurs aux insights

Apprenez à utiliser les outils d'IA pour analyser des données, créer des visualisations et obtenir des insights sans être data scientist.

No-Code AI Tools: Supercharging Your Productivity Without Writing Code

Discover the best no-code AI tools for 2026 and learn how to integrate them into your workflow for maximum productivity.

AI for Small Businesses in Morocco: A Practical Guide

Practical ways Moroccan small businesses can leverage AI tools to improve operations, marketing, and customer service.