I am aware that pandas
offer the opportunity to visualize data with plots. Most of the examples I can find and even pandas docu itself use Jupyter Notebook examples.
This code doesn't work in a row python shell.
#!/usr/bin/env python3
import pandas as pd
df = pd.DataFrame({'A': range(100)})
obj = df.hist(column='A')
# array([[<AxesSubplot:title={'center':'A'}>]], dtype=object)
How can I "show" that? This scripts runs not in an IDE. It runs in a Python 3.9.10 shell interpreter in Windows "Dos-Box" on Windows 10.
Installing jupyter or transfering the data to an external service is not an option in my case.
CodePudding user response:
Try something like this
df = pd.DataFrame({'A': list(range(100))})
df.plot(kind='line')
CodePudding user response:
Simple example:
import numpy as np
import matplotlib.pyplot as plt
data = [1, 2, 2, 2, 4, 1, 2]
counts, bins = np.histogram(data)
plt.hist(bins[:-1], bins, weights=counts)
plt.show()