diff --git a/src/pages/pandas.js b/src/pages/pandas.js index 6172466c46..58a0afdb48 100644 --- a/src/pages/pandas.js +++ b/src/pages/pandas.js @@ -5,8 +5,9 @@ import Container from 'react-bootstrap/Container'; import Contact from '../components/Contact'; import Row from 'react-bootstrap/Row'; import ChartFamilySection from '../components/ChartFamilySection'; +import ChartImage from '../components/ChartImage'; import { Link } from 'gatsby'; -import { Plotly } from '../components/MiscellaneousLogos'; +import { Pandas } from '../components/MiscellaneousLogos'; import { Col } from 'react-bootstrap'; import CodeChunk from '../components/CodeChunk'; import Spacing from '../components/Spacing'; @@ -16,13 +17,44 @@ import ChartImageContainer from '../components/ChartImageContainer'; const chartDescription = ( <>
- Beyond its powerful data manipulation capabilities, Pandas offers
- convenient plotting methods, enabling users to visualize data directly
- from DataFrame and Series objects.
+ Pandas is a popular open-source Python
+ library used for data manipulation and analysis. It provides data structures and functions
+ that make working with structured data, such as tabular data (like Excel
spreadsheets or
+ SQL
tables), easy and intuitive.
+
+ Although not best known for this functionality, Pandas can be used to create graphs and visualize + data, thanks to its lightweight syntax and matplotlib functions.
> ); +const quickCode = `# library +import pandas as pd +import matplotlib.pyplot as plt + +# Create data +values=[12, 11, 9, 13, 14, 16, 14, 15, 18, 17, 19, 20] +df=pd.DataFrame({'x': range(1,13), 'y': values }) + +# plot +df.plot('x', 'y') +plt.show() +`; + +const plotApi = `df.plot('x', 'y', kind='line') +plt.show() +`; + +const funcnameApi = `df.line('x', 'y') +plt.show() +`; + +const plotFuncnameApi = `df.plot.line('x', 'y') +plt.show() +`; + + export default function Plotlys() { return (This section is under construction and will be available soon.
+
+ Pandas
is the most famous python data
+ manipulation and cleaning library. However, it can also be used to
+ create charts and graphs. Pandas plotting features are a wrapper
+ around the matplotlib{' '}
+ library, which is the most popular python library for data visualization.
+
+ The plot
function is the most basic function to
+ create a chart with pandas. It is a wrapper around the{' '}
+ matplotlib.pyplot.plot
function.
+
+ There are 3 ways to build a chart with pandas: the{' '}
+ plot
method, the function name
method
+ (like line, bar or hist) and the plot + function name
method.
+
+ ➡️ plot method
+
+ In this case, we have to specify the kind
of chart we
+ want to create. The plot
method is a wrapper around the{' '}
+ matplotlib.pyplot.plot
function. The kind
{' '}
+ argument is used to specify the type of chart we want to create.
+
+ ➡️ function name method
+
+ The function name method is a bit more straightforward. We just have
+ to call the right function name to create the chart we want. Matplotlib has
+ various functions to create different types of charts. For example, the
+ line
function is used to create line charts.
+
+ ➡️ plot + function name method
+
+ This method is a combination of the previous two. We use the{' '}
+ plot
method and need the function name
+ right after it.
+
+ The function name
method is the most straightforward and
+ the one we recommend. Most posts on the gallery use this method.
+
+ Pandas offers a wide range of nice charts. Here is a selection of + examples that you can find on the gallery. Click on the images to see the code! +
+